Java Code Examples for org.apache.flink.runtime.rpc.RpcUtils#terminateRpcService()

The following examples show how to use org.apache.flink.runtime.rpc.RpcUtils#terminateRpcService() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ActiveResourceManagerFactoryTest.java    From flink with Apache License 2.0 6 votes vote down vote up
/**
 * Test which ensures that the {@link ActiveResourceManagerFactory} sets the correct managed
 * memory when creating a resource manager.
 */
@Test
public void createResourceManager_WithDefaultConfiguration_ShouldSetManagedMemory() throws Exception {
	final Configuration configuration = new Configuration();

	final TestingActiveResourceManagerFactory resourceManagerFactory = new TestingActiveResourceManagerFactory();

	final TestingRpcService rpcService = new TestingRpcService();

	try {
		final ResourceManager<ResourceID> ignored = resourceManagerFactory.createResourceManager(
			configuration,
			ResourceID.generate(),
			rpcService,
			new TestingHighAvailabilityServices(),
			new TestingHeartbeatServices(),
			NoOpMetricRegistry.INSTANCE,
			new TestingFatalErrorHandler(),
			new ClusterInformation("foobar", 1234),
			null,
			UnregisteredMetricGroups.createUnregisteredJobManagerMetricGroup());
	} finally {
		RpcUtils.terminateRpcService(rpcService, Time.seconds(10L));
	}
}
 
Example 2
Source File: ResourceManagerJobMasterTest.java    From flink with Apache License 2.0 6 votes vote down vote up
@After
public void teardown() throws Exception {
	if (resourceManager != null) {
		RpcUtils.terminateRpcEndpoint(resourceManager, TIMEOUT);
	}

	if (haServices != null) {
		haServices.closeAndCleanupAllData();
	}

	if (rpcService != null) {
		RpcUtils.terminateRpcService(rpcService, TIMEOUT);
	}

	if (testingFatalErrorHandler != null && testingFatalErrorHandler.hasExceptionOccurred()) {
		testingFatalErrorHandler.rethrowError();
	}
}
 
Example 3
Source File: AkkaRpcServiceTest.java    From Flink-CEPplus with Apache License 2.0 6 votes vote down vote up
/**
 * Tests that the {@link AkkaRpcService} terminates all its RpcEndpoints when shutting down.
 */
@Test
public void testAkkaRpcServiceShutDownWithRpcEndpoints() throws Exception {
	final AkkaRpcService akkaRpcService = startAkkaRpcService();

	try {
		final int numberActors = 5;

		CompletableFuture<Void> terminationFuture = akkaRpcService.getTerminationFuture();

		final Collection<CompletableFuture<Void>> onStopFutures = startStopNCountingAsynchronousOnStopEndpoints(akkaRpcService, numberActors);

		for (CompletableFuture<Void> onStopFuture : onStopFutures) {
			onStopFuture.complete(null);
		}

		terminationFuture.get();
		assertThat(akkaRpcService.getActorSystem().isTerminated(), is(true));
	} finally {
		RpcUtils.terminateRpcService(akkaRpcService, TIMEOUT);
	}
}
 
Example 4
Source File: TaskExecutorTest.java    From flink with Apache License 2.0 6 votes vote down vote up
@After
public void teardown() throws Exception {
	if (rpc != null) {
		RpcUtils.terminateRpcService(rpc, timeout);
		rpc = null;
	}

	if (dummyBlobCacheService != null) {
		dummyBlobCacheService.close();
		dummyBlobCacheService = null;
	}

	if (nettyShuffleEnvironment != null) {
		nettyShuffleEnvironment.close();
	}

	testingFatalErrorHandler.rethrowError();
}
 
Example 5
Source File: StandaloneResourceManagerFactoryTest.java    From flink with Apache License 2.0 6 votes vote down vote up
@Test
public void createResourceManager_WithLessMemoryThanContainerizedHeapCutoffMin_ShouldSucceed() throws Exception {
	final StandaloneResourceManagerFactory resourceManagerFactory = StandaloneResourceManagerFactory.INSTANCE;

	final TestingRpcService rpcService = new TestingRpcService();
	try {
		final Configuration configuration = new Configuration();
		configuration.setString(TaskManagerOptions.TASK_MANAGER_HEAP_MEMORY, new MemorySize(128 * 1024 * 1024).toString());
		configuration.setInteger(ResourceManagerOptions.CONTAINERIZED_HEAP_CUTOFF_MIN, 600);

		final ResourceManager<ResourceID> ignored = resourceManagerFactory.createResourceManager(
			configuration,
			ResourceID.generate(),
			rpcService,
			new TestingHighAvailabilityServices(),
			new TestingHeartbeatServices(),
			NoOpMetricRegistry.INSTANCE,
			new TestingFatalErrorHandler(),
			new ClusterInformation("foobar", 1234),
			null,
			UnregisteredMetricGroups.createUnregisteredJobManagerMetricGroup());
	} finally {
		RpcUtils.terminateRpcService(rpcService, Time.seconds(10L));
	}
}
 
Example 6
Source File: TaskExecutorTest.java    From flink with Apache License 2.0 6 votes vote down vote up
@After
public void teardown() throws Exception {
	if (rpc != null) {
		RpcUtils.terminateRpcService(rpc, timeout);
		rpc = null;
	}

	if (timerService != null) {
		timerService.stop();
		timerService = null;
	}

	if (dummyBlobCacheService != null) {
		dummyBlobCacheService.close();
		dummyBlobCacheService = null;
	}

	if (nettyShuffleEnvironment != null) {
		nettyShuffleEnvironment.close();
	}

	testingFatalErrorHandler.rethrowError();
}
 
Example 7
Source File: AkkaRpcServiceTest.java    From flink with Apache License 2.0 6 votes vote down vote up
/**
 * Tests that the {@link AkkaRpcService} terminates all its RpcEndpoints when shutting down.
 */
@Test
public void testAkkaRpcServiceShutDownWithRpcEndpoints() throws Exception {
	final AkkaRpcService akkaRpcService = startAkkaRpcService();

	try {
		final int numberActors = 5;

		CompletableFuture<Void> terminationFuture = akkaRpcService.getTerminationFuture();

		final Collection<CompletableFuture<Void>> onStopFutures = startStopNCountingAsynchronousOnStopEndpoints(akkaRpcService, numberActors);

		for (CompletableFuture<Void> onStopFuture : onStopFutures) {
			onStopFuture.complete(null);
		}

		terminationFuture.get();
		assertThat(akkaRpcService.getActorSystem().whenTerminated().isCompleted(), is(true));
	} finally {
		RpcUtils.terminateRpcService(akkaRpcService, TIMEOUT);
	}
}
 
Example 8
Source File: ResourceManagerJobMasterTest.java    From flink with Apache License 2.0 6 votes vote down vote up
@After
public void teardown() throws Exception {
	if (resourceManager != null) {
		RpcUtils.terminateRpcEndpoint(resourceManager, TIMEOUT);
	}

	if (haServices != null) {
		haServices.closeAndCleanupAllData();
	}

	if (rpcService != null) {
		RpcUtils.terminateRpcService(rpcService, TIMEOUT);
	}

	if (testingFatalErrorHandler != null && testingFatalErrorHandler.hasExceptionOccurred()) {
		testingFatalErrorHandler.rethrowError();
	}
}
 
Example 9
Source File: AkkaRpcServiceTest.java    From flink with Apache License 2.0 6 votes vote down vote up
/**
 * Tests that the {@link AkkaRpcService} terminates all its RpcEndpoints when shutting down.
 */
@Test
public void testAkkaRpcServiceShutDownWithRpcEndpoints() throws Exception {
	final AkkaRpcService akkaRpcService = startAkkaRpcService();

	try {
		final int numberActors = 5;

		CompletableFuture<Void> terminationFuture = akkaRpcService.getTerminationFuture();

		final Collection<CompletableFuture<Void>> onStopFutures = startStopNCountingAsynchronousOnStopEndpoints(akkaRpcService, numberActors);

		for (CompletableFuture<Void> onStopFuture : onStopFutures) {
			onStopFuture.complete(null);
		}

		terminationFuture.get();
		assertThat(akkaRpcService.getActorSystem().whenTerminated().isCompleted(), is(true));
	} finally {
		RpcUtils.terminateRpcService(akkaRpcService, TIMEOUT);
	}
}
 
Example 10
Source File: DispatcherTest.java    From flink with Apache License 2.0 5 votes vote down vote up
@AfterClass
public static void teardownClass() throws Exception {
	if (rpcService != null) {
		RpcUtils.terminateRpcService(rpcService, TIMEOUT);

		rpcService = null;
	}
}
 
Example 11
Source File: MiniDispatcherTest.java    From flink with Apache License 2.0 5 votes vote down vote up
@AfterClass
public static void teardownClass() throws IOException, InterruptedException, ExecutionException, TimeoutException {
	if (blobServer != null) {
		blobServer.close();
	}

	if (rpcService != null) {
		RpcUtils.terminateRpcService(rpcService, timeout);
	}
}
 
Example 12
Source File: ZooKeeperHADispatcherTest.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
@AfterClass
public static void teardownClass() throws Exception {
	if (rpcService != null) {
		RpcUtils.terminateRpcService(rpcService, TIMEOUT);
		rpcService = null;
	}

	if (blobServer != null) {
		blobServer.close();
		blobServer = null;
	}
}
 
Example 13
Source File: ZooKeeperHADispatcherTest.java    From flink with Apache License 2.0 5 votes vote down vote up
@AfterClass
public static void teardownClass() throws Exception {
	if (rpcService != null) {
		RpcUtils.terminateRpcService(rpcService, TIMEOUT);
		rpcService = null;
	}

	if (blobServer != null) {
		blobServer.close();
		blobServer = null;
	}
}
 
Example 14
Source File: MiniDispatcherTest.java    From flink with Apache License 2.0 5 votes vote down vote up
@AfterClass
public static void teardownClass() throws IOException, InterruptedException, ExecutionException, TimeoutException {
	if (blobServer != null) {
		blobServer.close();
	}

	if (rpcService != null) {
		RpcUtils.terminateRpcService(rpcService, timeout);
	}
}
 
Example 15
Source File: DispatcherTest.java    From flink with Apache License 2.0 5 votes vote down vote up
@AfterClass
public static void teardownClass() throws Exception {
	if (rpcService != null) {
		RpcUtils.terminateRpcService(rpcService, TIMEOUT);

		rpcService = null;
	}
}
 
Example 16
Source File: MiniDispatcherTest.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
@AfterClass
public static void teardownClass() throws IOException, InterruptedException, ExecutionException, TimeoutException {
	if (blobServer != null) {
		blobServer.close();
	}

	if (rpcService != null) {
		RpcUtils.terminateRpcService(rpcService, timeout);
	}
}
 
Example 17
Source File: DispatcherTest.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
@AfterClass
public static void teardownClass() throws Exception {
	if (rpcService != null) {
		RpcUtils.terminateRpcService(rpcService, TIMEOUT);

		rpcService = null;
	}
}
 
Example 18
Source File: ResourceManagerTaskExecutorTest.java    From flink with Apache License 2.0 4 votes vote down vote up
@AfterClass
public static void teardownClass() throws Exception {
	if (rpcService != null) {
		RpcUtils.terminateRpcService(rpcService, TIMEOUT);
	}
}
 
Example 19
Source File: AkkaRpcActorTest.java    From flink with Apache License 2.0 4 votes vote down vote up
@AfterClass
public static void shutdown() throws InterruptedException, ExecutionException, TimeoutException {
	RpcUtils.terminateRpcService(akkaRpcService, timeout);
}
 
Example 20
Source File: ResourceManagerTaskExecutorTest.java    From flink with Apache License 2.0 4 votes vote down vote up
@AfterClass
public static void teardownClass() throws Exception {
	if (rpcService != null) {
		RpcUtils.terminateRpcService(rpcService, TIMEOUT);
	}
}