List of usage examples for java.util.concurrent ConcurrentLinkedQueue wait
public final void wait() throws InterruptedException
From source file:net.jmhertlein.mcanalytics.plugin.daemon.ClientMonitor.java
private void write(PrintWriter out) { ConcurrentLinkedQueue<JSONObject> queue = dispatcher.getWriteQueue(); while (!shutdown) { if (queue.isEmpty()) { synchronized (queue) { try { queue.wait(); System.out.println("CL-WRITE: Got something to write!"); } catch (InterruptedException ex) { }//w ww . j a va2 s . c om } } else { String w = queue.remove().toString(); //System.out.println("CL-WRITE: WRITING THIS:======================="); //System.out.println(w); //System.out.println("=============================================="); out.println(w); out.flush(); } } //System.out.println("CL-WRITE: Exiting, turning off the lights..."); try { close(); } catch (IOException ex) { Logger.getLogger(ClientMonitor.class.getName()).log(Level.SEVERE, null, ex); } }