本文整理汇总了Java中akka.actor.ActorSystem.terminate方法的典型用法代码示例。如果您正苦于以下问题:Java ActorSystem.terminate方法的具体用法?Java ActorSystem.terminate怎么用?Java ActorSystem.terminate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类akka.actor.ActorSystem
的用法示例。
在下文中一共展示了ActorSystem.terminate方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: main
import akka.actor.ActorSystem; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {
final ActorSystem system = ActorSystem.create("512DB");
try {
ActorRef[] KVStores = new ActorRef[num];
for(int i =0; i < KVStores.length; i++){
KVStores[i] = system.actorOf(KVStore.props(), "KVStore" + i);
}
testQuery(KVStores);
System.out.println(">>> Press ENTER to exit <<<");
System.in.read();
} catch (IOException ioe) {
ioe.printStackTrace();
} finally {
system.terminate();
}
}
示例2: passesOmegaContextAmongActors
import akka.actor.ActorSystem; //导入方法依赖的package包/类
@Test
public void passesOmegaContextAmongActors() throws Exception {
ActorSystem actorSystem = ActorSystem.create();
ActorRef actorRef = actorSystem.actorOf(UserServiceActor.props(userService));
actorRef.tell(user, noSender());
waitTillSavedUser(username);
assertArrayEquals(
new String[] {
new TxStartedEvent(globalTxId, newLocalTxId, globalTxId, compensationMethod, user).toString(),
new TxEndedEvent(globalTxId, newLocalTxId, globalTxId, compensationMethod).toString()},
toArray(messages)
);
actorSystem.terminate();
}
示例3: run1
import akka.actor.ActorSystem; //导入方法依赖的package包/类
private void run1() {
final ActorSystem actorSystem = ActorSystem.create();
final Materializer materializer = ActorMaterializer.create(actorSystem);
final Source<Integer, NotUsed> source = Source.range(0, 10);
final Flow<Integer, String, NotUsed> flow = Flow.fromFunction((Integer i) -> i.toString());
final Sink<String, CompletionStage<Done>> sink = Sink.foreach(s -> System.out.println("Example1 - Number: " + s));
final RunnableGraph runnable = source.via(flow).to(sink);
runnable.run(materializer);
actorSystem.terminate();
}
示例4: run2
import akka.actor.ActorSystem; //导入方法依赖的package包/类
private void run2() {
final ActorSystem actorSystem = ActorSystem.create();
final Materializer materializer = ActorMaterializer.create(actorSystem);
Source.range(0, 10)
.map(Object::toString)
.runForeach(s -> System.out.println("Example 2 - Number: " + s), materializer);
actorSystem.terminate();
}
示例5: testClientDispatcherIsNotGlobalDispatcher
import akka.actor.ActorSystem; //导入方法依赖的package包/类
@Test
public void testClientDispatcherIsNotGlobalDispatcher() {
ActorSystem actorSystem = ActorSystem.create("with-custom-dispatchers",
ConfigFactory.load("application-with-custom-dispatchers.conf"));
ActorContext actorContext = new ActorContext(actorSystem, mock(ActorRef.class), mock(ClusterWrapper.class),
mock(Configuration.class), DatastoreContext.newBuilder().build(), new PrimaryShardInfoFutureCache());
assertNotEquals(actorSystem.dispatchers().defaultGlobalDispatcher(), actorContext.getClientDispatcher());
actorSystem.terminate();
}