Code example for Queue

Methods: offer

0
				} 
			} 
		} 
		 
		public void addTask(Runnable r){ 
			queue.offer(r); 
		} 
		 
		private void executeTasks(){ 
			while(true){ 
				Runnable r = queue.poll(); 
				if(r == null){ 
					break; 
				} 
				r.run(); 
			} 
		} 
	} 
	 
	private void addTask(Runnable runnable){ 
		thread.addTask(runnable);