Code example for BlockingQueue

Methods: size, take

0
	 * @return 
	 * @throws InterruptedException 
	 */ 
	public BaseRequest getRequest() { 
		try { 
			return sendPool.size() > 0 ? sendPool.take() : null;
		} catch (InterruptedException e) {
			// TODO Auto-generated catch block 
			e.printStackTrace();
		} 
		return null; 
	} 
 
	// 写入发送完成 
	public void setResponse(int messageId, BaseResponse response) {
		receivePool.put(messageId, response);
	} 
 
}