I'm not sure if this is the correct way to synchronize my ArrayList.
I have an ArrayList in_queue which is passed in from the registerInQueue function.
ArrayList<Record> in_queue = null;
public void registerInQueue(ArrayList in_queue)
{
this.in_queue = in_queue;
}
Now I'm trying to synchronize it. Is this sychronizing my in_queue object correctly?
List<Record> in_queue_list = Collections.synchronizedList(in_queue);
synchronized (in_queue_list) {
while (in_queue_list.size() > 0) {
in_queue_list.remove(0);
}
}