public Object readObject() throws EOFException { synchronized (queue) { while (queue.isEmpty()) try { Thread.sleep(250); } catch (InterruptedException e) { } return queue.poll(); } }