當前位置: 首頁>>代碼示例>>Java>>正文


Java Kill類代碼示例

本文整理匯總了Java中akka.actor.Kill的典型用法代碼示例。如果您正苦於以下問題:Java Kill類的具體用法?Java Kill怎麽用?Java Kill使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


Kill類屬於akka.actor包,在下文中一共展示了Kill類的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: stopServer

import akka.actor.Kill; //導入依賴的package包/類
@Override
public void stopServer(RpcServer selfGateway) {
	if (selfGateway instanceof AkkaBasedEndpoint) {
		final AkkaBasedEndpoint akkaClient = (AkkaBasedEndpoint) selfGateway;
		final RpcEndpoint rpcEndpoint;

		synchronized (lock) {
			if (stopped) {
				return;
			} else {
				rpcEndpoint = actors.remove(akkaClient.getActorRef());
			}
		}

		if (rpcEndpoint != null) {
			akkaClient.getActorRef().tell(Kill.getInstance(), ActorRef.noSender());
		} else {
			LOG.debug("RPC endpoint {} already stopped or from different RPC service", selfGateway.getAddress());
		}
	}
}
 
開發者ID:axbaretto,項目名稱:flink,代碼行數:22,代碼來源:AkkaRpcService.java

示例2: testTerminationOnFatalError

import akka.actor.Kill; //導入依賴的package包/類
@Test
public void testTerminationOnFatalError() {
	highAvailabilityServices.setJobMasterLeaderRetriever(
		HighAvailabilityServices.DEFAULT_JOB_ID,
		new TestingLeaderRetrievalService());

	new JavaTestKit(system){{

		final ActorGateway taskManager = TestingUtils.createTaskManager(
				system,
				highAvailabilityServices, // no jobmanager
				new Configuration(),
				true,
				false);

		try {
			watch(taskManager.actor());
			taskManager.tell(new FatalError("test fatal error", new Exception("something super bad")));
			expectTerminated(d, taskManager.actor());
		}
		finally {
			taskManager.tell(Kill.getInstance());
		}
	}};
}
 
開發者ID:axbaretto,項目名稱:flink,代碼行數:26,代碼來源:TaskManagerTest.java

示例3: onReceive

import akka.actor.Kill; //導入依賴的package包/類
@Override
public void onReceive(Object msg) throws Exception {
	if(msg instanceof Restart) {
		log.info("killing application");
		
		app.tell(Kill.getInstance(), getSelf());
	} else if(msg instanceof GetActorTree) {
		log.info("actor tree requested");
		
		// we have to manually forward the message
		// as the monitor actor isn't allowed to talk
		// to the publisher service directly.
		ActorRef self = getSelf(), sender = getSender();
		f.ask(monitor, new GetTree(), Tree.class).thenAccept(tree -> {
			sender.tell(tree, self);
		});
	} else {
		unhandled(msg);
	}
}
 
開發者ID:IDgis,項目名稱:geo-publisher,代碼行數:21,代碼來源:Admin.java

示例4: shutdown

import akka.actor.Kill; //導入依賴的package包/類
/**
 * Shuts down this registry and the associated {@link MetricReporter}.
 */
public void shutdown() {
	synchronized (lock) {
		Future<Boolean> stopFuture = null;
		FiniteDuration stopTimeout = null;

		if (queryService != null) {
			stopTimeout = new FiniteDuration(1L, TimeUnit.SECONDS);

			try {
				stopFuture = Patterns.gracefulStop(queryService, stopTimeout);
			} catch (IllegalStateException ignored) {
				// this can happen if the underlying actor system has been stopped before shutting
				// the metric registry down
				// TODO: Pull the MetricQueryService actor out of the MetricRegistry
				LOG.debug("The metric query service actor has already been stopped because the " +
					"underlying ActorSystem has already been shut down.");
			}
		}

		if (reporters != null) {
			for (MetricReporter reporter : reporters) {
				try {
					reporter.close();
				} catch (Throwable t) {
					LOG.warn("Metrics reporter did not shut down cleanly", t);
				}
			}
			reporters = null;
		}
		shutdownExecutor();

		if (stopFuture != null) {
			boolean stopped = false;

			try {
				stopped = Await.result(stopFuture, stopTimeout);
			} catch (Exception e) {
				LOG.warn("Query actor did not properly stop.", e);
			}

			if (!stopped) {
				// the query actor did not stop in time, let's kill him
				queryService.tell(Kill.getInstance(), ActorRef.noSender());
			}
		}
	}
}
 
開發者ID:axbaretto,項目名稱:flink,代碼行數:51,代碼來源:MetricRegistryImpl.java

示例5: stopActor

import akka.actor.Kill; //導入依賴的package包/類
private static void stopActor(ActorRef actor) {
	if (actor != null) {
		actor.tell(Kill.getInstance(), ActorRef.noSender());
	}
}
 
開發者ID:axbaretto,項目名稱:flink,代碼行數:6,代碼來源:FlinkUntypedActorTest.java


注:本文中的akka.actor.Kill類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。