cxf-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrea Smyth <>
Subject JAX-WS async calls not async?
Date Mon, 27 Nov 2006 11:21:40 GMT
With an implementor that sleeps 3 seconds in String greetMe(String name) 
I was expecting the following system test to pass:

public void testAsync() {
        GreeterService service = new GreeterService();
        Greeter greeter = service.getGreeterPort();
        long before = System.currentTimeMillis();
        Response<GreetMeResponse> r1 = greeter.greetMeAsync("one");
        Response<GreetMeResponse> r2 = greeter.greetMeAsync("two");
        long after = System.currentTimeMillis();
        assertTrue("Duration of calls exceeded 6000 ms", after - before 
< 6000);
        // first time round, responses should not be available yet
        assertFalse("Response already available.", r1.isDone());
        assertFalse("Response already available.", r2.isDone());
        // after three seconds responses should be available
        long waited = 0;
        while (waited < 5000) {
            try {
            } catch (InterruptedException ex) {
               // ignore
            if (r1.isDone() && r2.isDone()) {
            waited += 500;
        assertTrue("Response is  not available.", r1.isDone());
        assertTrue("Response is  not available.", r2.isDone());

However the test fails as the second invocation is apparently only made 
after the first one has returned a response, i.e. it fails with
junit.framework.AssertionFailedError: Duration of calls exceeded 6000 ms.
Am I overlooking something or has the async invocation model not been 
implemented yet?
There are system tests in place, but these seem to not verify that at 
some point after the initial (async) invocation, the response is NOT yet 
available - they only test that it will eventually become available.


View raw message