Package org.mule.util.concurrent

Examples of org.mule.util.concurrent.Latch.await()


        muleClient.dispatch("vm://invokeAcmeAmi",
                            ACME_TEST_MESSAGE,
                            null);

        latch.await(getTestTimeoutSecs(), TimeUnit.SECONDS);//<co id="lis_12_acme_api_bridge_improved_test-4"/>

        // DB and HTTP assertions unchanged...
        //<end id="lis_12_acme_api_bridge_improved_test"/>
        MuleMessage dbResponse =
                    muleClient.request("jdbc://retrieveData",
View Full Code Here


                    transactionCommitLatch.release();
                }
            }
        });
        execSqlUpdate("INSERT INTO TEST(TYPE, DATA, ACK, RESULT) VALUES(1, NULL, NULL, NULL)");
        if (!(transactionCommitLatch.await(5, TimeUnit.SECONDS)))
        {
            fail("Transaction wasn't commited");   
        }
        assertThat(getCountWithType2(),Is.is(1));
        assertThat(getCountWithType3(),Is.is(1));
View Full Code Here

                    if (logger.isDebugEnabled())
                    {
                        logger.debug("Waiting for return event for: " + timeout + " ms on " + replyTo);
                    }

                    l.await(timeout, TimeUnit.MILLISECONDS);
                    consumer.setMessageListener(null);
                    listener.release();
                    Message result = listener.getMessage();
                    if (result == null)
                    {
View Full Code Here

                        workExecutedInCurrentThread.set(true);
                        return;
                    }
                    try
                    {
                        holdThreads.await();
                    }
                    catch (InterruptedException e)
                    {
                        throw new RuntimeException(e);
                    }
View Full Code Here

        // Send first event through the flow (thread 1)
        processEvent(executorService, true);

        // Wait until the first query is executed (now thread 1 holds a connection to the DB as the flow is transactional)
        Latch firstQueryExecutedLatch = muleContext.getRegistry().lookupObject("firstQueryExecutedLatch");
        firstQueryExecutedLatch.await();

        // Send second event through the flow (thread 2)
        processEvent(executorService, false);

        // Thread 2 will skip the first outbound endpoint and will try to execute the second one. It will borrow
View Full Code Here

        });
        //The '/response' channel is set on the request message
        client.subscribe("/response");
        //Simulates dispatching from the browser
        client.publish("/request", TEST_JSON_MESSAGE, null);
        latch.await(DEFAULT_TEST_TIMEOUT_SECS, TimeUnit.SECONDS);
        assertNotNull(data.get());
        assertEquals("{\"value1\":\"foo\",\"value2\":\"bar\"}", data.get());
    }
}
View Full Code Here

        bayeuxClient.subscribe("/test1");

        MuleClient muleClient = muleContext.getClient();
        muleClient.dispatch("vm://in1", "Ross", null);

        latch.await(10, TimeUnit.SECONDS);
        assertNotNull(data.get());

        // parse the result string into java objects.  different jvms return it in different order, so we can't do a straight string comparison
        ObjectMapper mapper = new ObjectMapper();
        Map<?, ?> result  = mapper.readValue((String) data.get(), Map.class);
View Full Code Here

        });
        client.subscribe("/test1");

        MuleClient muleClient = muleContext.getClient();
        muleClient.dispatch("vm://in1", "Ross", null);
        assertTrue("data did not arrive on time", latch.await(DEFAULT_TEST_TIMEOUT_SECS,
                                                                    TimeUnit.SECONDS));

        assertNotNull(data.get());

        // parse the result string into java objects. different jvms return it in
View Full Code Here

    {
        Latch receiveLatch = new Latch();
        setupTestServiceComponent(receiveLatch);

        sendJabberMessageFromNewThread();
        assertTrue(receiveLatch.await(RECEIVE_TIMEOUT, TimeUnit.MILLISECONDS));
    }

    private void setupTestServiceComponent(Latch receiveLatch) throws Exception
    {
        Object testComponent = getComponent(RECEIVE_SERVICE_NAME);
View Full Code Here

    {
        Latch receiveLatch = new Latch();
        setupTestServiceComponent(receiveLatch);

        sendJabberMessageFromNewThread();
        assertTrue(receiveLatch.await(RECEIVE_TIMEOUT, TimeUnit.MILLISECONDS));
    }

    private void setupTestServiceComponent(Latch receiveLatch) throws Exception
    {
        Object testComponent = getComponent(RECEIVE_SERVICE_NAME);
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.