Examples of BlockingQueue


Examples of java.util.concurrent.BlockingQueue

    /**
     * drainTo(null, n) throws NullPointerException
     */
    public void testDrainToNullN() {
        final BlockingQueue q = emptyCollection();
        try {
            q.drainTo(null, 0);
            shouldThrow();
        } catch (NullPointerException success) {
        }
    }
View Full Code Here

Examples of java.util.concurrent.BlockingQueue

     * add succeeds if not full; throws ISE if full
     */
    @Test
    public void testAdd() {
        try {
            BlockingQueue q = new LocalConcurrentBlockingObjectQueue(SIZE);
            for (int i = 0; i < SIZE; ++i) {
                assertTrue(q.add(new Integer(i)));
            }
            assertEquals(0, q.remainingCapacity());
            q.add(new Integer(SIZE));
            shouldThrow();
        } catch (IllegalStateException success) {
        }
    }
View Full Code Here

Examples of java.util.concurrent.BlockingQueue

    /**
     * drainTo(this, n) throws IllegalArgumentException
     */
    public void testDrainToSelfN() {
        final BlockingQueue q = emptyCollection();
        try {
            q.drainTo(q, 0);
            shouldThrow();
        } catch (IllegalArgumentException success) {
        }
    }
View Full Code Here

Examples of jmt.engine.NodeSections.BlockingQueue

        br = regions.get(i);

        String regionName = br.getName();
        String inputStationName = regionName + "_inputStation";

        InputSection is = new BlockingQueue(br);
        ServiceSection ss = new ServiceTunnel();
        OutputSection os = new BlockingRouter();

        SimNode inputStation = new SimNode(inputStationName, is, ss, os);
        inputStation.getNode().setBlockingRegionInputStation(br);
View Full Code Here

Examples of org.apache.maven.plugin.surefire.util.internal.BlockingQueue

    final int num = 100000;

    public void testPut()
        throws Exception
    {
        BlockingQueue twoThreadBlockingQueue = new TwoThreadBlockingQueue();

        String[] items = generate( num );
        //long start = System.currentTimeMillis();
        for ( String item : items )
        {
            twoThreadBlockingQueue.add( item );
        }
        //long elapsed = System.currentTimeMillis() - start;
        //System.out.println( "TwoThreadBlockingQueue insert " + num + " elements in  = " + elapsed );
        System.gc();
    }
View Full Code Here

Examples of org.apache.mina.util.BlockingQueue

            releaseThreadId( id );
        }

        private Runnable fetchRunnable()
        {
            BlockingQueue unfetchedRunnables = LeaderFollowersThreadPool.this.unfetchedRunnables;

            synchronized( unfetchedRunnables )
            {
                while( !shuttingDown )
                {
                    try
                    {
                        unfetchedRunnables.waitForNewItem();
                    }
                    catch( InterruptedException e )
                    {
                        continue;
                    }
View Full Code Here

Examples of org.apache.mina.util.BlockingQueue

    }

    private void fireEvent( NextFilter nextFilter, IoSession session,
                              EventType type, Object data )
    {
        final BlockingQueue unfetchedSessionBuffers = this.unfetchedSessionBuffers;
        final Set allSessionBuffers = this.allSessionBuffers;
        final Event event = new Event( type, nextFilter, data );

        synchronized( unfetchedSessionBuffers )
        {
            final SessionBuffer buf = getSessionBuffer( session );
            final Queue eventQueue = buf.eventQueue;

            synchronized( buf )
            {
                eventQueue.push( event );
            }

            if( !allSessionBuffers.contains( buf ) )
            {
                allSessionBuffers.add( buf );
                unfetchedSessionBuffers.push( buf );
            }
        }
    }
View Full Code Here

Examples of org.apache.mina.util.BlockingQueue

            releaseThreadId( id );
        }

        private SessionBuffer fetchBuffer()
        {
            BlockingQueue unfetchedSessionBuffers = ThreadPoolFilter.this.unfetchedSessionBuffers;
            synchronized( unfetchedSessionBuffers )
            {
                while( !shuttingDown )
                {
                    try
                    {
                        unfetchedSessionBuffers.waitForNewItem();
                    }
                    catch( InterruptedException e )
                    {
                        continue;
                    }
View Full Code Here

Examples of org.apache.mina.util.BlockingQueue

            }
        }

        private void releaseBuffer( SessionBuffer buf )
        {
            final BlockingQueue unfetchedSessionBuffers = ThreadPoolFilter.this.unfetchedSessionBuffers;
            final Set allSessionBuffers = ThreadPoolFilter.this.allSessionBuffers;
            final Queue eventQueue = buf.eventQueue;

            synchronized( unfetchedSessionBuffers )
            {
                if( eventQueue.isEmpty() )
                {
                    allSessionBuffers.remove( buf );
                    removeSessionBuffer( buf );
                }
                else
                {
                    unfetchedSessionBuffers.push( buf );
                }
            }
        }
View Full Code Here

Examples of org.mom4j.xcp.util.BlockingQueue

    XcpListener(XcpConfig cfg) {
        super("XcpListener");
   
        this.config  = cfg;
        this.queue   = new BlockingQueue();
        this.server  = null;
        this.stopped = false;
        this.running = false;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.