Package scala.concurrent

Examples of scala.concurrent.ExecutionContext


  @Test
  public void testCustomAckConsumerRoute() throws Exception {
    MockEndpoint mockEndpoint = camel.context().getEndpoint("mock:mockAck", MockEndpoint.class);
    FiniteDuration duration = Duration.create(10, TimeUnit.SECONDS);
    Timeout timeout = new Timeout(duration);
    ExecutionContext executionContext = system.dispatcher();
    ActorRef consumer = Await.result(
      camel.activationFutureFor(
        system.actorOf(
          Props.create(TestAckConsumer.class, "direct:testConsumerAck","mock:mockAck"), "testConsumerAck"),
      timeout, executionContext),
View Full Code Here


  }

  @Test
  public void testCustomAckConsumerRouteFromUri() throws Exception {
    MockEndpoint mockEndpoint = camel.context().getEndpoint("mock:mockAckUri", MockEndpoint.class);
      ExecutionContext executionContext = system.dispatcher();
    FiniteDuration duration = Duration.create(10, TimeUnit.SECONDS);
    Timeout timeout = new Timeout(duration);
    ActorRef consumer = Await.result(
      camel.activationFutureFor(system.actorOf(Props.create(TestAckConsumer.class, "direct:testConsumerAckFromUri","mock:mockAckUri"), "testConsumerAckUri"),
      timeout, executionContext),
View Full Code Here

  @Test(expected=CamelExecutionException.class)
  public void testCustomTimeoutConsumerRoute() throws Exception {
    FiniteDuration duration = Duration.create(10, TimeUnit.SECONDS);
    Timeout timeout = new Timeout(duration);
    ExecutionContext executionContext = system.dispatcher();
    ActorRef consumer = Await.result(
      camel.activationFutureFor(system.actorOf(Props.create(TestAckConsumer.class, "direct:testConsumerException","mock:mockException"), "testConsumerException"),
      timeout, executionContext),
    duration);
    camel.context().addRoutes(new CustomRouteBuilder("direct:testException", consumer, false, Duration.create(0, TimeUnit.SECONDS)));
View Full Code Here

  private static ExecutionContext ec = ExecutionContexts.global();

  @Test
  public void createAndRead() throws Exception {
    //#create
    ExecutionContext ec = ExecutionContexts.global();
    Agent<Integer> agent = Agent.create(5, ec);
    //#create

    //#read-get
    Integer result = agent.get();
View Full Code Here

      public Integer apply(Integer i) {
        return i * 1;
      }
    };

    ExecutionContext theExecutionContextToExecuteItIn = ec;
    //#send-off
    // sendOff a function
    agent.sendOff(longRunningOrBlockingFunction,
                  theExecutionContextToExecuteItIn);
    //#send-off
View Full Code Here

        public Integer apply(Integer i) {
            return i * 1;
        }
    };

    ExecutionContext theExecutionContextToExecuteItIn = ec;
    //#alter-off
    // alterOff a function (Mapper)
    Future<Integer> f3 = agent.alterOff(longRunningOrBlockingFunction,
                                        theExecutionContextToExecuteItIn);
    //#alter-off
View Full Code Here

    private ExecutionContext myThreadPool = null;

    //#async-explicit-ec
    public Promise<Result> index2() {
      // Wrap an existing thread pool, using the context from the current thread
      ExecutionContext myEc = HttpExecution.fromThread(myThreadPool);
      return Promise.promise(() -> intensiveComputation(), myEc)
                    .map((Integer i) -> ok("Got result: " + i), myEc);
    }
View Full Code Here

    private ExecutionContext myThreadPool = null;

    //#async-explicit-ec
    public Promise<Result> index2() {
      // Wrap an existing thread pool, using the context from the current thread
      ExecutionContext myEc = HttpExecution.fromThread(myThreadPool);
      Promise<Integer> promiseOfInt = Promise.promise(
        new Function0<Integer>() {
          public Integer apply() {
            return intensiveComputation();
          }
View Full Code Here

TOP

Related Classes of scala.concurrent.ExecutionContext

Copyright © 2018 www.massapicom. 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.