title: Java : Multi-threaded linked list access synchronization
body: <p>My methodology may be wrong here (or implemented better). If so, please let me know of a better idea.</p>
  
  <p>I am trying to implement a shape file reader that works with local files or over a network. However, some of the shapefiles are HUGE, and could take a while to completely load. I would like to separate the loading class into its own thread. I would also like for the main thread to extract the loaded data from the loader, while it is still loading, so it can be displayed immediately.</p>
  
  <p>To accomplish this, I figured I could maintain a linked list within the loader containing the elements that have already been completely loaded. The main thread can poll the loader to see if any elements have been loaded, and extract the head of the linked list, which would remove it from the loader.</p>
  
  <p>What mechanisms can I use to ensure that the main class and the loader class do not attempt to access the head of the linked list at the same time? I know this involves synchronization, but I am a total noob with Java threads. Just need someone to point me in the right direction.</p>
  
  <p>If you have a different idea altogether, I'm all ears. 
  Thanks</p>