Code example for LinkedBlockingQueue

Methods: size

0
			throw new RuntimeException("Can't add message to queue",ex);
		} 
	} 
 
	public int getQueueSize() { 
		return this.queue.size();
	} 
 
	protected void failIfNotConnected() throws RuntimeException { 
		if (!this.bot.isConnected()) throw new RuntimeException("Trying to send message when no longer connected");
	} 
 
	public void run() { 
		try { 
			while (true) { 
				String line = this.queue.take();
				failIfNotConnected(); 
				if ((line != null) && (this.bot.isConnected())) {
					sendRawLineNow(line);
				}