Package edu.emory.mathcs.backport.java.util.concurrent

Examples of edu.emory.mathcs.backport.java.util.concurrent.CountDownLatch.await()


        // Send the messages
        sendMessages(session, destination, 4);
        sendDone.countDown();
       
        // Wait for first 2 messages to arrive.
        assertTrue(got2Done.await(100000, TimeUnit.MILLISECONDS));

        // Re-start connection.
        connection = (ActiveMQConnection) factory.createConnection();
        connections.add(connection);
       
View Full Code Here


                    e.printStackTrace();
                }
            }
        });

        assertTrue(done2.await(1000, TimeUnit.MILLISECONDS));
        Thread.sleep(200);
       
        // Make sure only 4 messages were delivered.
        assertEquals(4, counter.get());
View Full Code Here

        });

        // Send the messages
        sendMessages(session, destination, 4);

        assertTrue(done.await(1000, TimeUnit.MILLISECONDS));
        Thread.sleep(200);
       
        // Make sure only 4 messages were delivered.
        assertEquals(4, counter.get());
    }
View Full Code Here

        });

        // Send the messages
        sendMessages(session, destination, 4);

        assertTrue(done.await(1000, TimeUnit.MILLISECONDS));
        Thread.sleep(200);
       
        // Make sure only 4 messages were delivered.
        assertEquals(4, counter.get());
    }
View Full Code Here

                BytesMessage message = session.createBytesMessage();
                message.writeBytes(new byte[1024]);
                connection.start();
                connectionsEstablished.release();

                while (!sampleTimeDone.await(0, TimeUnit.MILLISECONDS)) {
                    producer.send(message);
                    producedMessages.incrementAndGet();
                }

                connection.close();
View Full Code Here

                    }
                });
                connection.start();

                connectionsEstablished.release();
                sampleTimeDone.await();

                connection.close();
                workerDone.release();
                return null;
            }
View Full Code Here

                work.run();
            }
        });
        long t = System.currentTimeMillis();
        try {
            latch.await();
        } catch (InterruptedException e) {
            throw new WorkException("Interrupted", e);
        }
        return System.currentTimeMillis() - t;
    }
View Full Code Here

        CountDownLatch stopLatch = new CountDownLatch(1);
        EJBClientWorker worker = new EJBClientWorker(msgContext, startLatch, stopLatch);
        workerPool.execute(worker);
        startLatch.countDown();
        try {
            stopLatch.await();
        } catch (InterruptedException e) {
            throw AxisFault.makeFault(e);
        }

        if (worker.getException() != null) {
View Full Code Here

        c1.set( future.getSession() );
        ((IoSession) c1.get()).write( "start" );

        ThreadMXBean threadMXBean = ManagementFactory.getThreadMXBean();

        while ( !messageCount.await( 100, TimeUnit.MILLISECONDS ) ) {
            long[] threads = threadMXBean.findMonitorDeadlockedThreads();

            if ( null != threads ) {
                StringBuffer sb = new StringBuffer( 256 );
                ThreadInfo[] infos = threadMXBean.getThreadInfo( threads, Integer.MAX_VALUE );
View Full Code Here

        } finally {
            // tell thread to start cleanup (e.g., end and rollback the tx)
            cleanupSignal.countDown();

            // wait for our thread to finish cleanup
            endSignal.await();
        }
    }

    public void testOnlyOneImportedTxAtATime() throws Exception {
        Xid xid1 = xidFactory.createXid();
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.