I share a list between many thread. All the data needed by the thread are there before they start, I don't add any other value to the list. Each tread take a value in list, value is removed from the list and there is a distant call done. This block is synchronized.
while (!contactList.isEmpty()) {
Contact contact = null;
synchronized (contactList) {
if (!contactList.isEmpty()) {
contact = contactList.get(0);
contactList.remove(0);
}
}
//call the service with contact
}
Is there a more efficient way to do the job?
For the moment, it's faster to take all contact and split them to many individual program.