Code example for LinkedBlockingQueue

Methods: add

0
		queue = new LinkedBlockingQueue<String>();
		outputStreamList = new LinkedList<OutputStream>();
	} 
 
	public void addMessage(String msg) {
		queue.add(msg);
	} 
 
	public void addOutputStream(OutputStream o) {
		outputStreamList.add(o);
	} 
 
	public void addOutputStream(Socket s) throws IOException {
		outputStreamList.add(s.getOutputStream());
	} 
 
	public void writeFirstMessage() throws IOException, InterruptedException { 
		log.log(Level.INFO, "Entered WriterThread's writeFirstMessage");
 
		String msg = queue.take() + "\n";