Code example for BlockingQueue

Methods: put

0
 
	// Enqueue a command 
	public void send_message(String cmd) {
		try { 
			Log.d(TAG, "adding " + cmd);
			queue.put(cmd);
		} catch (InterruptedException e) {
			// This really shouldn't happen 
			e.printStackTrace();
		} 
	} 
 
	public void send_stop() { 
		Log.d(TAG, "in send_stop()");
		queue.clear();
		try { 
			writeLock.acquire();
			Log.d(TAG, "sending feedhold");
			write("!"); 
			Log.d(TAG, "sending {\"qf\":1}");
			write("{\"qf\":1}\n");