Code example for LinkedBlockingQueue

Methods: put

0
		//if internal queue is empty execute immediately, else put in secondary queue. 
		if (getQueue().size() == 0) {
			super.execute(command);
		} else { 
			try { 
				secondary.put(command);
			} catch (InterruptedException e) {
				e.printStackTrace();
			} 
		} 
	} 
 
	@Override 
	protected void afterExecute(Runnable r, Throwable t) {
		if (secondary.size() > 0) {
			Runnable next = secondary.poll();
			if (next != null) {
				super.execute(next);
			} 
		} 
Contextual code suggestions in your IDE  Get Codota for Java