Search in sources :

Example 1 with TimeoutManager

use of com.yahoo.jdisc.TimeoutManager in project vespa by vespa-engine.

the class TimeoutManagerImplTestCase method requireThatNoEntryIsMadeIfTimeoutHandlerHasBeenSet.

@Test
public void requireThatNoEntryIsMadeIfTimeoutHandlerHasBeenSet() {
    final Context ctx = new Context(MyRequestHandler.newInstance());
    new RequestDispatch() {

        @Override
        protected Request newRequest() {
            Request request = new Request(ctx.driver, URI.create(REQUEST_URI));
            request.setTimeout(10, TimeUnit.MILLISECONDS);
            request.setTimeoutManager(new TimeoutManager() {

                @Override
                public void scheduleTimeout(Request request) {
                }
            });
            return request;
        }
    }.dispatch();
    assertFalse(ctx.awaitQueueSize(1, 100, TimeUnit.MILLISECONDS));
    assertTrue(ctx.awaitQueueSize(0, 600, TimeUnit.SECONDS));
    ctx.requestHandler.respond();
    assertTrue(ctx.close());
}
Also used : RequestDispatch(com.yahoo.jdisc.handler.RequestDispatch) TimeoutManager(com.yahoo.jdisc.TimeoutManager) NonWorkingRequest(com.yahoo.jdisc.test.NonWorkingRequest) Request(com.yahoo.jdisc.Request) Test(org.junit.Test)

Aggregations

Request (com.yahoo.jdisc.Request)1 TimeoutManager (com.yahoo.jdisc.TimeoutManager)1 RequestDispatch (com.yahoo.jdisc.handler.RequestDispatch)1 NonWorkingRequest (com.yahoo.jdisc.test.NonWorkingRequest)1 Test (org.junit.Test)1