Package org.apache.maven.plugin.surefire.util.internal

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


    }

    public void testFunkyPut()
        throws Exception
    {
        FunkyTwoThreadBlockingQueue twoThreadBlockingQueue = new FunkyTwoThreadBlockingQueue();

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



    public void testPutAndTake()
        throws Exception
    {
        final FunkyTwoThreadBlockingQueue twoThreadBlockingQueue = new FunkyTwoThreadBlockingQueue();

        Callable<String> consumer = new Callable<String>()
        {
            public String call()
                throws Exception
            {
                int num = 0;
                String taken;
                do
                {
                    taken = twoThreadBlockingQueue.take();
                    if ( taken != TwoThreadBlockingQueue.poison )
                    {
                        Assert.assertEquals( "item" + num++, taken );
                    }
                }
                while ( taken != TwoThreadBlockingQueue.poison );
                return taken;
            }
        };

        FutureTask<String> futureTask = new FutureTask<String>( consumer );
        Thread thread = new Thread( futureTask );
        thread.start();

        String[] items = generate( num );
        //long start = System.currentTimeMillis();
        for ( String item : items )
        {
            twoThreadBlockingQueue.put( item );
        }
        twoThreadBlockingQueue.put( TwoThreadBlockingQueue.poison );
        //long elapsed = System.currentTimeMillis() - start;

        futureTask.get();

        // System.out.println( "TwoThreadBlockingQueue produced and taken " + num + " elements in  = " + elapsed );
View Full Code Here

TOP

Related Classes of org.apache.maven.plugin.surefire.util.internal.FunkyTwoThreadBlockingQueue

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.