2023-01-08 17:13:31 +08:00
|
|
|
/*
|
|
|
|
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
|
|
|
* license agreements; and to You under the Apache License, version 2.0:
|
|
|
|
|
*
|
|
|
|
|
* https://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
|
*
|
|
|
|
|
* This file is part of the Apache Pekko project, derived from Akka.
|
|
|
|
|
*/
|
|
|
|
|
|
2018-03-13 23:45:55 +09:00
|
|
|
/*
|
2022-02-04 12:36:44 +01:00
|
|
|
* Copyright (C) 2018-2022 Lightbend Inc. <https://www.lightbend.com>
|
2018-03-13 23:45:55 +09:00
|
|
|
*/
|
|
|
|
|
|
2017-07-26 04:09:45 +09:00
|
|
|
package jdocs.future;
|
|
|
|
|
|
2019-01-12 04:00:53 +08:00
|
|
|
// #context-dispatcher
|
2022-11-12 10:21:24 +01:00
|
|
|
import org.apache.pekko.actor.AbstractActor;
|
|
|
|
|
import org.apache.pekko.dispatch.Futures;
|
2017-07-26 04:09:45 +09:00
|
|
|
|
|
|
|
|
public class ActorWithFuture extends AbstractActor {
|
2019-01-12 04:00:53 +08:00
|
|
|
ActorWithFuture() {
|
2017-07-26 04:09:45 +09:00
|
|
|
Futures.future(() -> "hello", getContext().dispatcher());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public Receive createReceive() {
|
|
|
|
|
return AbstractActor.emptyBehavior();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// #context-dispatcher
|