org.apache.flink.runtime.rpc.exceptions.RpcConnectionException Java Examples

The following examples show how to use org.apache.flink.runtime.rpc.exceptions.RpcConnectionException. 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: AkkaRpcActorTest.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
/**
 * Tests that a {@link RpcConnectionException} is thrown if the rpc endpoint cannot be connected to.
 */
@Test
public void testFailingAddressResolution() throws Exception {
	CompletableFuture<DummyRpcGateway> futureRpcGateway = akkaRpcService.connect("foobar", DummyRpcGateway.class);

	try {
		futureRpcGateway.get(timeout.getSize(), timeout.getUnit());

		fail("The rpc connection resolution should have failed.");
	} catch (ExecutionException exception) {
		// we're expecting a RpcConnectionException
		assertTrue(exception.getCause() instanceof RpcConnectionException);
	}
}
 
Example #2
Source File: AkkaRpcActorTest.java    From flink with Apache License 2.0 5 votes vote down vote up
/**
 * Tests that a {@link RpcConnectionException} is thrown if the rpc endpoint cannot be connected to.
 */
@Test
public void testFailingAddressResolution() throws Exception {
	CompletableFuture<DummyRpcGateway> futureRpcGateway = akkaRpcService.connect("foobar", DummyRpcGateway.class);

	try {
		futureRpcGateway.get(timeout.getSize(), timeout.getUnit());

		fail("The rpc connection resolution should have failed.");
	} catch (ExecutionException exception) {
		// we're expecting a RpcConnectionException
		assertTrue(exception.getCause() instanceof RpcConnectionException);
	}
}
 
Example #3
Source File: AkkaRpcService.java    From flink with Apache License 2.0 5 votes vote down vote up
private CompletableFuture<ActorRef> resolveActorAddress(String address) {
	final ActorSelection actorSel = actorSystem.actorSelection(address);

	return actorSel.resolveOne(TimeUtils.toDuration(configuration.getTimeout()))
		.toCompletableFuture()
		.exceptionally(error -> {
			throw new CompletionException(
				new RpcConnectionException(String.format("Could not connect to rpc endpoint under address %s.", address), error));
		});
}
 
Example #4
Source File: AkkaRpcActorTest.java    From flink with Apache License 2.0 5 votes vote down vote up
/**
 * Tests that a {@link RpcConnectionException} is thrown if the rpc endpoint cannot be connected to.
 */
@Test
public void testFailingAddressResolution() throws Exception {
	CompletableFuture<DummyRpcGateway> futureRpcGateway = akkaRpcService.connect("foobar", DummyRpcGateway.class);

	try {
		futureRpcGateway.get(timeout.getSize(), timeout.getUnit());

		fail("The rpc connection resolution should have failed.");
	} catch (ExecutionException exception) {
		// we're expecting a RpcConnectionException
		assertTrue(exception.getCause() instanceof RpcConnectionException);
	}
}