Package EDU.oswego.cs.dl.util.concurrent

Examples of EDU.oswego.cs.dl.util.concurrent.CountDown


                         CopletInstanceData coplet,
                         ContentHandler handler) {
        this.adapter = adapter;
        this.coplet  = coplet;
        this.handler = handler;
        this.finished = new CountDown( 1 );
    }
View Full Code Here


            {
                getLogger().error( "Cannot get RunnableManager", se );
                throw new IOException( "Cannot get RunnableManager" );
            }

            final CountDown done = new CountDown( 1 );
            StreamPumper errPumper = new StreamPumper(compilerErr, tmpErr, done);
            runnableManager.execute( errPumper );
            m_serviceManager.release( runnableManager );

            p.waitFor();
            exitValue = p.exitValue();

            done.acquire(); // Wait for StreadmPumper to finish
            compilerErr.close();

            p.destroy();

            tmpErr.close();
View Full Code Here

        public LoaderThread(Source source,
                            XMLSerializer serializer,
                            ServiceManager manager) {
            this.source = source;
            this.serializer = serializer;
            this.finished = new CountDown( 1 );
            this.manager = manager;
        }
View Full Code Here

            {
                getLogger().error( "Cannot get RunnableManager", se );
                throw new IOException( "Cannot get RunnableManager" );
            }

            final CountDown done = new CountDown( 1 );
            StreamPumper errPumper = new StreamPumper(compilerErr, tmpErr, done);
            runnableManager.execute( errPumper );
            m_serviceManager.release( runnableManager );

            p.waitFor();
            exitValue = p.exitValue();

            done.acquire(); // Wait for StreadmPumper to finish
            compilerErr.close();

            p.destroy();

            tmpErr.close();
View Full Code Here

        public LoaderThread(Source source,
                            XMLSerializer serializer,
                            ServiceManager manager) {
            this.source = source;
            this.serializer = serializer;
            this.finished = new CountDown( 1 );
            this.manager = manager;
        }
View Full Code Here

            System.out.println("Warning: no countDown available!");
        }
    }

    protected void sendSomeMessagesAndCheckTheyAreAllReceived(int numberOfMessages) throws JMSException, InterruptedException {
        countDown = new CountDown(numberOfMessages);

        // send messages
        for (int i = 0; i < numberOfMessages; i++) {
            producer.send(producerDestination, session.createTextMessage("hi"));
        }
View Full Code Here

        countDown.attempt(5000);
        assertEquals("Undelivered messages for count: " + numberOfMessages, 0, countDown.currentCount());
    }

    protected void sendSomeMessagesReusingTheSameMessageAndCheckTheyAreAllReceived(int numberOfMessages) throws JMSException, InterruptedException {
        countDown = new CountDown(numberOfMessages);

        // send messages
        TextMessage message = session.createTextMessage();
        for (int i = 0; i < numberOfMessages; i++) {
            message.setText("This is message: " + i);
View Full Code Here

    public void onMessage(Message message) {
        countDown.release();
    }

    protected void sendSomeMessagesAndCheckTheyAreAllReceived(int numberOfMessages) throws JMSException, InterruptedException {
        countDown = new CountDown(numberOfMessages);

        // send messages
        for (int i = 0; i < numberOfMessages; i++) {
            producer.send(destination, session.createTextMessage("hi"));
        }
View Full Code Here

    public void testConcurrentRequests() throws Exception {

        final int WORKERS = 10;
        final int MESSAGE_COUNT = 10;
        final CyclicBarrier barrier = new CyclicBarrier(WORKERS);
        final CountDown finished = new CountDown(WORKERS);

        for (int i = 0; i < WORKERS; i++) {

            new Thread() {
                /**
                 * @see java.lang.Thread#run()
                 */
                public void run() {
                    try {
                        barrier.barrier();

                        for (int i = 0; i < MESSAGE_COUNT; i++)
                            sp.sendDown(allocateDownPacket());


                    } catch (Exception e) {
                        e.printStackTrace();
                    } finally {
                        finished.release();
                    }
                }
            }.start();
        }

        finished.acquire();

        Thread.sleep(5 * 1000);

        assertEquals(WORKERS * MESSAGE_COUNT, count);
    }
View Full Code Here

   private static final Logger log = Logger.getLogger(MockInvokerInterruptTestCase.class);
  
   public void test000() throws Throwable
   {
      InvokerLocator il = new InvokerLocator("unittest", "127.0.0.1", 9999, "mock", null);
      CountDown startGate = new CountDown(1);
      MockMicroSocketClientInvoker ci = new MockMicroSocketClientInvoker(il, startGate);
      InvocationRequest ir = new InvocationRequest("", "", null, null, null, il);
     
      Runnable interrupterRunnable = new ThreadInterrupter(Thread.currentThread(), startGate);
      Thread interrupter = new Thread(interrupterRunnable);
View Full Code Here

TOP

Related Classes of EDU.oswego.cs.dl.util.concurrent.CountDown

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.