Search in sources :

Example 6 with EngineBuilder

use of com.linkedin.parseq.EngineBuilder in project rest.li by linkedin.

the class TestParSeqRestClient method setUp.

@SuppressWarnings("deprecation")
@BeforeClass
public void setUp() throws Exception {
    super.init();
    final int numCores = Runtime.getRuntime().availableProcessors();
    _scheduler = Executors.newScheduledThreadPool(numCores + 1);
    _engine = new EngineBuilder().setTaskExecutor(_scheduler).setTimerScheduler(_scheduler).build();
    _restClient = new ParSeqRestClient(getClient());
}
Also used : ParSeqRestClient(com.linkedin.restli.client.ParSeqRestClient) EngineBuilder(com.linkedin.parseq.EngineBuilder) BeforeClass(org.testng.annotations.BeforeClass)

Example 7 with EngineBuilder

use of com.linkedin.parseq.EngineBuilder in project rest.li by linkedin.

the class RestLiIntTestServer method main.

public static void main(String[] args) throws IOException {
    final int numCores = Runtime.getRuntime().availableProcessors();
    final ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(numCores + 1);
    final Engine engine = new EngineBuilder().setTaskExecutor(scheduler).setTimerScheduler(scheduler).build();
    HttpServer server = createServer(engine, DEFAULT_PORT, supportedCompression);
    server.start();
    System.out.println("HttpServer running on port " + DEFAULT_PORT + ". Press any key to stop server");
    System.in.read();
    server.stop();
    engine.shutdown();
}
Also used : ScheduledExecutorService(java.util.concurrent.ScheduledExecutorService) HttpServer(com.linkedin.r2.transport.http.server.HttpServer) EngineBuilder(com.linkedin.parseq.EngineBuilder) Engine(com.linkedin.parseq.Engine)

Aggregations

EngineBuilder (com.linkedin.parseq.EngineBuilder)7 Engine (com.linkedin.parseq.Engine)5 ScheduledExecutorService (java.util.concurrent.ScheduledExecutorService)5 ResourceFactory (com.linkedin.restli.server.resources.ResourceFactory)3 ExecutorService (java.util.concurrent.ExecutorService)3 HttpServer (com.linkedin.r2.transport.http.server.HttpServer)2 RestLiServer (com.linkedin.restli.server.RestLiServer)2 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 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 FilterChain (com.linkedin.r2.filter.FilterChain)1 SimpleLoggingFilter (com.linkedin.r2.filter.logging.SimpleLoggingFilter)1 RequestContext (com.linkedin.r2.message.RequestContext)1 RestMethod (com.linkedin.r2.message.rest.RestMethod)1 RestRequest (com.linkedin.r2.message.rest.RestRequest)1