Code example for ArrayBlockingQueue

Methods: polltake

0
	 * @return 
	 * @throws Exception  
	 */ 
	public T get() throws Exception 
	{ 
		T instance = availables.poll();
 
		if (instance != null)
		{ 
			return instance;
		} 
 
		int created = count.getAndIncrement();
 
		if (created < sizeLimit.get())
		{ 
			return factory.create();
		} 
		// the limit is reach 
		else 
		{ 
			count.decrementAndGet();
			 
			//wait it become available 
			return availables.take();
		} 
 
	} 
 
	public void recycle(T toRecycle) throws Exception