Best code examples for Java 8 SynchronousQueue class (java.util.concurrent.SynchronousQueue)

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Java 8 SynchronousQueue class.
You can now enable Codota on your own code to easily search and navigate your Java codebase.

Java 8 SynchronousQueue examples from Open Source projects
This code example shows how to use the following methods: poll
            throw new TimeoutException("Failed to acquire request scheduler slot for '" + key + "'");
    } 
 
    public Thread poll()
    { 
        Entry e = queue.poll();
        if (e == null)
            return null; 
        metric.addNano(System.nanoTime() - e.creationTime);
        return e.thread;
    } 
 
    @Override 
    public String toString()
    { 
        return "RoundRobinScheduler.WeightedQueue(key=" + key + " weight=" + weight + ")";
    } 
 
    private final static class Entry 
    { 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods:
 * @see ERXTaskThread 
 * @see ERXExecutorService 
 *  
 */ 
public class ERXExecutorService { 
	private static final ExecutorService _executorService = new ERXTaskThreadPoolExecutor(0, Integer.MAX_VALUE, 60L, 
					TimeUnit.SECONDS, new SynchronousQueue<Runnable>(), new ERXTaskThreadFactory()); 
 
	/**  
	 * @return a global ExecutorService with no limit for executing runnables.  
	 **/ 
	public static ExecutorService executorService() { 
		return _executorService; 
	} 
 
	/** 
	 * This ExecutorService is useful when you want to execute tasks in parallel, but you want to (create and) 
	 * submit new tasks for execution only when the pool has at least one idle thread. 
	 *  
	 * A task will be rejected with a {@link RejectedExecutionException} when all the threads are busy 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods:
 
        @Override 
        public synchronized void start(final StartContext context) throws StartException {
            executorService = new ThreadPoolExecutor(0, Integer.MAX_VALUE,
                    5L, TimeUnit.SECONDS,
                    new SynchronousQueue<Runnable>(),
                    threadFactory);
        } 
 
        @Override 
        public synchronized void stop(final StopContext context) {
            Thread executorShutdown = new Thread(new Runnable() {
                @Override 
                public void run() { 
                    try { 
                        executorService.shutdown();
                    } finally { 
                        executorService = null;
                        context.complete();
                    } 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods:
	protected BlockingQueue<Runnable> createQueue(int queueCapacity) {
		if (queueCapacity > 0) {
			return new LinkedBlockingQueue<Runnable>(queueCapacity);
		} 
		else { 
			return new SynchronousQueue<Runnable>();
		} 
	} 
 
 
	@Override 
	public ExecutorService getObject() throws Exception {
		return this.exposedExecutor;
	} 
 
	@Override 
	public Class<? extends ExecutorService> getObjectType() {
		return (this.exposedExecutor != null ? this.exposedExecutor.getClass() : ExecutorService.class);
	} 
 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods:
    return new ZoieThreadPoolExecutor(nThreads, nThreads, 0L, TimeUnit.MILLISECONDS, 
        new LinkedBlockingQueue<Runnable>(), threadFactory); 
  } 
 
  public static ExecutorService newCachedThreadPool() { 
    return new ZoieThreadPoolExecutor(0, Integer.MAX_VALUE, 60L, TimeUnit.SECONDS, 
        new SynchronousQueue<Runnable>()); 
  } 
 
  public static ExecutorService newCachedThreadPool(ThreadFactory threadFactory) { 
    return new ThreadPoolExecutor(0, Integer.MAX_VALUE, 60L, TimeUnit.SECONDS, 
        new SynchronousQueue<Runnable>(), threadFactory); 
  } 
} 
Full Snippet Info
6
CodeRank
See Code Examples for Java 8 SynchronousQueue Methods: