At first, I assumed that throwing spears were treated much like musket shots - as a single ranged attack that hopefully does a good amount of damage before melee is necessary.
The almogavars lead me to question this assumption, especially regarding people like the welsh and the vikings who apparently used an abundance of throwing spears.
In Egil's Saga during Egil's battle with Bjergønund it clearly states that they both keep their kesja (kind of spear) in their hands and swords in their belts while walking around the countryside. When they see each other Egil puts his sword around his arm in a leather strop, so he can freely throw the spear, after which he takes his sword in his hand.
So it seems that they didn't but instead put their sword away. Alternatively you could speculate that is is possible to hold a short javelin with your shield, but that's pure speculation on my part.
Source: Egil Skallagrimsons saga, translated to Danish by Johannes V. Jensen