本文整理匯總了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();
}