Package java.util.concurrent

Examples of java.util.concurrent.LinkedBlockingQueue$LBQSpliterator





    public static void testBlockingQueue() {
        final BlockingQueue queue=new LinkedBlockingQueue();

        Thread taker=new Thread() {

            public void run() {
                try {
                    System.out.println("taking an element from the queue");
                    queue.take();
                    System.out.println("clear");
                }
                catch(InterruptedException e) {                 
                }
            }
        };
        taker.start();

        Util.sleep(500);

        queue.clear(); // does this release the taker thread ?
        Util.interruptAndWaitToDie(taker);
        assert !(taker.isAlive()) : "taker: " + taker;
    }
View Full Code Here


        // 1. Create a Selector
        selector=Selector.open();

        // Create a thread pool (Executor)
        executor=new ThreadPoolExecutor(MIN_THREAD_POOL_SIZE, MAX_THREAD_POOL_SIZE, 30000, TimeUnit.MILLISECONDS,
                                        new LinkedBlockingQueue(1000));

        for (Iterator it=mappings.keySet().iterator(); it.hasNext();) {
            key=(MyInetSocketAddress) it.next();
            value=(MyInetSocketAddress) mappings.get(key);
View Full Code Here

     * @param numberOfThreads
     */
    public Jdk15ThreadPool(int numberOfThreads)
    {
        _execService = new ThreadPoolExecutor( numberOfThreads, numberOfThreads, 0L, TimeUnit.MILLISECONDS,
                                               new LinkedBlockingQueue(), new EJThreadFactory() );
    }
View Full Code Here

     * @param numberOfThreads
     */
    public Jdk15ThreadPool(final ThreadGroup threadGroup, int numberOfThreads)
    {
        _execService = new ThreadPoolExecutor( numberOfThreads, numberOfThreads, 0L, TimeUnit.MILLISECONDS,
                                               new LinkedBlockingQueue(), new EJThreadFactory( threadGroup ) );
        // _execService.prestartAllCoreThreads();
    }
View Full Code Here

        if (!threadPoolEnabled)
            return new NonParallelExecutor();

        final ThreadPoolExecutor executorService = new ThreadPoolExecutor(coreSize, maxSize,
                                                                          keepAliveMillis, TimeUnit.MILLISECONDS,
                                                                          new LinkedBlockingQueue());

        shutdownHub.addRegistryShutdownListener(new RegistryShutdownListener()
        {
            public void registryDidShutdown()
            {
View Full Code Here

    public void prepare(Map stormConf, TopologyContext context,
                        final OutputCollector collector) {
        Object maxPending = stormConf.get(Config.TOPOLOGY_SHELLBOLT_MAX_PENDING);
        if (maxPending != null) {
           this._pendingWrites = new LinkedBlockingQueue(((Number)maxPending).intValue());
        }
        _rand = new Random();
        _collector = collector;

        _context = context;
View Full Code Here

    public ServicePool(ServerService next, final String name, int threads) {
        this.next = next;

        final int keepAliveTime = (1000 * 60 * 5);

        threadPool = new ThreadPoolExecutor(threads, threads, keepAliveTime, TimeUnit.MILLISECONDS, new LinkedBlockingQueue());
        threadPool.setThreadFactory(new ThreadFactory() {
            private volatile int id = 0;

            public Thread newThread(Runnable arg0) {
                Thread thread = new Thread(arg0, name + " " + getNextID());
View Full Code Here

        Processor childProcessor = routeContext.createProcessor(this);
        if (aggregationStrategy == null) {
            aggregationStrategy = new UseLatestAggregationStrategy();
        }
        if (threadPoolExecutor == null) {
            threadPoolExecutor = new ThreadPoolExecutor(4, 16, 0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue());
        }
        return new Splitter(getExpression().createExpression(routeContext), childProcessor, aggregationStrategy,
                isParallelProcessing(), threadPoolExecutor, streaming);
    }
View Full Code Here

     * one.
     *
     * @param maxSize Maximum size of the work executor pool.
     */
    public WorkExecutorPoolImpl(int maxSize) {
        pooledExecutor = new ThreadPoolExecutor(1, maxSize, 60, TimeUnit.SECONDS, new LinkedBlockingQueue());
        /*
        FIXME: How to do this with concurrent.util ?
        pooledExecutor.waitWhenBlocked();
        */
    }
View Full Code Here

    public CommandExecutor() {
    }

    public CommandExecutor(WorkingMemory workingMemory) {
        this.workingMemory = workingMemory;           
        this.queue = new LinkedBlockingQueue();
    }       
View Full Code Here

TOP

Related Classes of java.util.concurrent.LinkedBlockingQueue$LBQSpliterator

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.