If I do something like:
List<Object> list= new ArrayList<Object>();
queue.drainTo(list); //BlockingQueue
Am I assured that other threads can not put or take elements from the queue while drainTo() is being executed?
Otherwise, should I lock the whole queue before calling drainTo()?