Code example for LinkedBlockingQueue

Methods: clear

0
	 
	@Override 
	protected void finalize() throws Throwable { 
		if (this.service != null && this.service.isAlive()) {
			this.service.interrupt();
			this.eventGroup.clear();
		} 
		super.finalize(); 
	} 
 
	public void run() { 
		while (true) { 
			try { 
				EventMessage msg = eventGroup.take();
				while(!popEvent(msg)) {
					try { 
						Thread.sleep(500);
					} catch (InterruptedException e) {	}
				} 
			} catch (InterruptedException e) {	}
		}