Examples of BoundedBuffer


Examples of org.dbunit.util.concurrent.BoundedBuffer

    private Object _taken = null;
    private boolean _eod = false;

    public StreamingIterator(IDataSetProducer source) throws DataSetException
    {
        Channel channel = new BoundedBuffer(30);
        _channel = channel;

        AsynchronousConsumer consumer = new AsynchronousConsumer(source, channel);
        Thread thread = new Thread(consumer);
        thread.setDaemon(true);
View Full Code Here

Examples of thread.reentrancy.conditions.BoundedBuffer

public class TestBoundedBuffer extends TestCase {
    private static final long LOCKUP_DETECT_TIMEOUT = 1000;

    @Test
    public void testTakeBlocksWhenEmpty() {
        final   BoundedBuffer bb = new BoundedBuffer();
        Thread taker = new Thread() {
            public void run() {
                try {
                    Object unused = bb.take();
                    fail(); // if we get here, it's an error
                } catch (InterruptedException success) {
                }
            }
        };
        try {
             bb.put(1);
            taker.start();
            Thread.sleep(LOCKUP_DETECT_TIMEOUT);
            taker.interrupt();
            // The timed join ensures that the test completes even if
            // take gets stuck in some unexpected way.
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.