Search in sources :

Example 1 with PromiseResolvedException

use of com.linkedin.parseq.promise.PromiseResolvedException in project rest.li by linkedin.

the class TestAsyncMethodInvocationPlanClass method engine.

private Engine engine(SettablePromise<Trace> traceHolder) {
    ExecutorService taskScheduler = Executors.newFixedThreadPool(1);
    ScheduledExecutorService timerScheduler = Executors.newSingleThreadScheduledExecutor();
    return new EngineBuilder().setTaskExecutor(taskScheduler).setTimerScheduler(timerScheduler).setPlanCompletionListener(planCtx -> {
        try {
            traceHolder.done(planCtx.getRootTask().getTrace());
        } catch (PromiseResolvedException e) {
        }
    }).build();
}
Also used : Engine(com.linkedin.parseq.Engine) DataProvider(org.testng.annotations.DataProvider) URISyntaxException(java.net.URISyntaxException) Assert.assertEquals(org.testng.Assert.assertEquals) RestRequestBuilder(com.linkedin.r2.message.rest.RestRequestBuilder) Test(org.testng.annotations.Test) Callback(com.linkedin.common.callback.Callback) RestLiConfig(com.linkedin.restli.server.RestLiConfig) RestResponse(com.linkedin.r2.message.rest.RestResponse) MultiplexerRunMode(com.linkedin.restli.server.multiplexer.MultiplexerRunMode) Trace(com.linkedin.parseq.trace.Trace) ResourceModel(com.linkedin.restli.internal.server.model.ResourceModel) PromiseResolvedException(com.linkedin.parseq.promise.PromiseResolvedException) SettablePromise(com.linkedin.parseq.promise.SettablePromise) RestConstants(com.linkedin.restli.common.RestConstants) RestLiServer(com.linkedin.restli.server.RestLiServer) Map(java.util.Map) ScheduledExecutorService(java.util.concurrent.ScheduledExecutorService) AllProtocolVersions(com.linkedin.restli.internal.common.AllProtocolVersions) StringMap(com.linkedin.data.template.StringMap) URI(java.net.URI) JacksonDataCodec(com.linkedin.data.codec.JacksonDataCodec) RestMethod(com.linkedin.r2.message.rest.RestMethod) IndividualRequestMap(com.linkedin.restli.common.multiplexer.IndividualRequestMap) ExecutorService(java.util.concurrent.ExecutorService) HttpMethod(com.linkedin.restli.common.HttpMethod) RestRequest(com.linkedin.r2.message.rest.RestRequest) ImmutableMap(com.google.common.collect.ImmutableMap) Promises(com.linkedin.parseq.promise.Promises) IOException(java.io.IOException) Executors(java.util.concurrent.Executors) ResourceFactory(com.linkedin.restli.server.resources.ResourceFactory) TimeUnit(java.util.concurrent.TimeUnit) MultiplexedRequestContent(com.linkedin.restli.common.multiplexer.MultiplexedRequestContent) CountDownLatch(java.util.concurrent.CountDownLatch) RequestContext(com.linkedin.r2.message.RequestContext) EngineBuilder(com.linkedin.parseq.EngineBuilder) Assert.assertTrue(org.testng.Assert.assertTrue) IndividualRequest(com.linkedin.restli.common.multiplexer.IndividualRequest) Collections(java.util.Collections) ScheduledExecutorService(java.util.concurrent.ScheduledExecutorService) PromiseResolvedException(com.linkedin.parseq.promise.PromiseResolvedException) ScheduledExecutorService(java.util.concurrent.ScheduledExecutorService) ExecutorService(java.util.concurrent.ExecutorService) EngineBuilder(com.linkedin.parseq.EngineBuilder)

Aggregations

ImmutableMap (com.google.common.collect.ImmutableMap)1 Callback (com.linkedin.common.callback.Callback)1 JacksonDataCodec (com.linkedin.data.codec.JacksonDataCodec)1 StringMap (com.linkedin.data.template.StringMap)1 Engine (com.linkedin.parseq.Engine)1 EngineBuilder (com.linkedin.parseq.EngineBuilder)1 PromiseResolvedException (com.linkedin.parseq.promise.PromiseResolvedException)1 Promises (com.linkedin.parseq.promise.Promises)1 SettablePromise (com.linkedin.parseq.promise.SettablePromise)1 Trace (com.linkedin.parseq.trace.Trace)1 RequestContext (com.linkedin.r2.message.RequestContext)1 RestMethod (com.linkedin.r2.message.rest.RestMethod)1 RestRequest (com.linkedin.r2.message.rest.RestRequest)1 RestRequestBuilder (com.linkedin.r2.message.rest.RestRequestBuilder)1 RestResponse (com.linkedin.r2.message.rest.RestResponse)1 HttpMethod (com.linkedin.restli.common.HttpMethod)1 RestConstants (com.linkedin.restli.common.RestConstants)1 IndividualRequest (com.linkedin.restli.common.multiplexer.IndividualRequest)1 IndividualRequestMap (com.linkedin.restli.common.multiplexer.IndividualRequestMap)1 MultiplexedRequestContent (com.linkedin.restli.common.multiplexer.MultiplexedRequestContent)1