Java 8 BlockingDeque - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Java 8 BlockingDeque class.

This code example shows how to use the following methods:add
        session.getBasicRemote().sendText("Hello");
    } 
 
    @OnMessage 
    public void message(final String message) {
        queue.add(message);
    } 
 
    public String getMessage() throws InterruptedException {
        return queue.poll(5, TimeUnit.SECONDS);
    } 
 
} 
7
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:clear
    public static String getName() {
        return name;
    } 
 
    public static void reset() { 
        queue.clear();
        postConstructCalled = false;
        injectionOK = false;
        AnnotatedClient.name = null;
    } 
} 
7
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:poll
		String payload2 = "re mi";
 
		final String PATTERN = "p*";
		final String ANOTHER_CHANNEL = "pubsub::test::extra";
 
		BlockingDeque<String> bag2 = new LinkedBlockingDeque<String>(99);
		MessageListenerAdapter anotherListener = new MessageListenerAdapter(new MessageHandler("handler2", bag2));
		anotherListener.setSerializer(template.getValueSerializer());
		anotherListener.afterPropertiesSet();
 
		// remove adapter from all channels 
		container.addMessageListener(anotherListener, new PatternTopic(PATTERN));
		container.removeMessageListener(adapter);
 
		// test no messages are sent just to patterns 
		template.convertAndSend(CHANNEL, payload1);
		template.convertAndSend(ANOTHER_CHANNEL, payload2);
 
		// anotherListener receives both messages 
		List<String> msgs = new ArrayList<String>();

6
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:add
 
	public BlockingDeque<Throwable> throwables = new LinkedBlockingDeque<Throwable>();
 
 
	public void handleError(Throwable t) {
		throwables.add(t);
	} 
 
} 
6
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:push
     * 
     * @param process 
     */ 
    public static void asynch(Runnable process) {
        if (Thread.currentThread() != gameThread) {
            pendingRunnables.push(process);
        } else { 
            process.run();
        } 
    } 
 
    /** 
     * Runs a process on the game thread, waiting for it to run (the current thread is blocked). 
     * <p/> 
     * If the current thread is the game thread, then the process runs immediately 
     * 
     * @param process 
     */ 
    public static void synch(Runnable process) throws InterruptedException {
        if (Thread.currentThread() != gameThread) {
5
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:add
 
	public BlockingDeque<Throwable> throwables = new LinkedBlockingDeque<Throwable>();
 
	@Override 
	public void handleError(Throwable t) {
		throwables.add(t);
	} 
 
} 
5
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:sleep, clear
		assumeTrue(RedisTestProfileValueSource.matches("runLongTests", "true")); 
	} 
 
	@Before 
	public void setUp() throws Exception {
		bag.clear();
 
		adapter.setSerializer(template.getValueSerializer());
		adapter.afterPropertiesSet();
 
		container = new RedisMessageListenerContainer();
		container.setConnectionFactory(template.getConnectionFactory());
		container.setBeanName("container");
		container.addMessageListener(adapter, Arrays.asList(new ChannelTopic(CHANNEL)));
		container.setTaskExecutor(new SyncTaskExecutor());
		container.setSubscriptionExecutor(new SimpleAsyncTaskExecutor());
		container.afterPropertiesSet();
		container.start();
 
		Thread.sleep(1000);

5
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:add
   public void quit() { 
      quit = true;
   } 
 
   public void addStringWrittenToIndex(String termToAdd) {
      stringsInIndex.add(termToAdd);
   } 
 
   public void waitForStart() throws InterruptedException {
      startSignal.await();
   } 
 
   public void startWaitingThreads() { 
      startSignal.countDown();
   } 
 
} 
5
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:putFirst
    return delegate().remainingCapacity();
  } 
 
  @Override 
  public void putFirst(E e) throws InterruptedException {
    delegate().putFirst(e);
  } 
 
  @Override 
  public void putLast(E e) throws InterruptedException {
    delegate().putLast(e);
  } 
 
  @Override 
  public boolean offerFirst(E e, long timeout, TimeUnit unit) throws InterruptedException {
    return delegate().offerFirst(e, timeout, unit);
  } 
 
  @Override 
  public boolean offerLast(E e, long timeout, TimeUnit unit) throws InterruptedException {
5
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:add
public class StubErrorHandler implements ErrorHandler {
 
	public BlockingDeque<Throwable> throwables = new LinkedBlockingDeque<Throwable>();
 
	public void handleError(Throwable t) {
		throwables.add(t);
	} 
 
} 
5
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
See Code Examples for Java 8 BlockingDeque Methods: