Code example for ArrayBlockingQueue

Methods: add

0
	private final ArrayBlockingQueue<Message> messages = new ArrayBlockingQueue<Message>(
			1); 
 
	public void processMessage(Chat chat, Message message) {
		Log.d("yskang", "Fake server receive msg: " + message.getBody());
		messages.add(message);
	} 
 
	public void receivesAMessage(Matcher<? super String> messageMatcher)
			throws InterruptedException { 
		final Message message = messages.poll(5, TimeUnit.SECONDS);
		assertThat(message, is(notNullValue()));
		assertThat(message.getBody(), messageMatcher);
	} 
} 
Contextual code suggestions in your IDE  Get Codota for Java