Code example for BlockingQueue

Methods: offer

0
			this.socketChannel.write(b);
		} 
 
		// If we didn't get it all sent, add it to the buffer of buffers 
		if (b.remaining() > 0) {
			if (!this.bufferQueue.offer(b)) {
				throw new IOException("Buffers are full, message could not be sent to"
						+ this.socketChannel.socket().getRemoteSocketAddress());
			} 
			return false; 
		} 
		return true; 
	} 
 
	// actual connection logic 
	private void _connect() throws IOException { 
		// Continuous loop that is only supposed to end when "close" is called. 
 
		selector.select();
		Set<SelectionKey> keys = selector.selectedKeys();
		Iterator<SelectionKey> i = keys.iterator();