org.apache.flink.runtime.io.network.netty.exception.RemoteTransportException Java Examples

The following examples show how to use org.apache.flink.runtime.io.network.netty.exception.RemoteTransportException. 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: PartitionRequestClientFactory.java    From Flink-CEPplus with Apache License 2.0 6 votes vote down vote up
@Override
public void operationComplete(ChannelFuture future) throws Exception {
	if (future.isSuccess()) {
		handInChannel(future.channel());
	}
	else if (future.cause() != null) {
		notifyOfError(new RemoteTransportException(
				"Connecting to remote task manager + '" + connectionId.getAddress() +
						"' has failed. This might indicate that the remote task " +
						"manager has been lost.",
				connectionId.getAddress(), future.cause()));
	}
	else {
		notifyOfError(new LocalTransportException(
			String.format(
				"Connecting to remote task manager '%s' has been cancelled.",
				connectionId.getAddress()),
			null));
	}
}
 
Example #2
Source File: PartitionRequestClientFactory.java    From flink with Apache License 2.0 6 votes vote down vote up
@Override
public void operationComplete(ChannelFuture future) throws Exception {
	if (future.isSuccess()) {
		handInChannel(future.channel());
	}
	else if (future.cause() != null) {
		notifyOfError(new RemoteTransportException(
				"Connecting to remote task manager + '" + connectionId.getAddress() +
						"' has failed. This might indicate that the remote task " +
						"manager has been lost.",
				connectionId.getAddress(), future.cause()));
	}
	else {
		notifyOfError(new LocalTransportException(
			String.format(
				"Connecting to remote task manager '%s' has been cancelled.",
				connectionId.getAddress()),
			null));
	}
}
 
Example #3
Source File: PartitionRequestClientFactory.java    From flink with Apache License 2.0 6 votes vote down vote up
@Override
public void operationComplete(ChannelFuture future) throws Exception {
	if (future.isSuccess()) {
		handInChannel(future.channel());
	}
	else if (future.cause() != null) {
		notifyOfError(new RemoteTransportException(
				"Connecting to remote task manager + '" + connectionId.getAddress() +
						"' has failed. This might indicate that the remote task " +
						"manager has been lost.",
				connectionId.getAddress(), future.cause()));
	}
	else {
		notifyOfError(new LocalTransportException(
			String.format(
				"Connecting to remote task manager '%s' has been cancelled.",
				connectionId.getAddress()),
			null));
	}
}
 
Example #4
Source File: PartitionRequestClientHandler.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
@Override
public void channelInactive(ChannelHandlerContext ctx) throws Exception {
	// Unexpected close. In normal operation, the client closes the connection after all input
	// channels have been removed. This indicates a problem with the remote task manager.
	if (!inputChannels.isEmpty()) {
		final SocketAddress remoteAddr = ctx.channel().remoteAddress();

		notifyAllChannelsOfErrorAndClose(new RemoteTransportException(
				"Connection unexpectedly closed by remote task manager '" + remoteAddr + "'. "
						+ "This might indicate that the remote task manager was lost.",
				remoteAddr));
	}

	super.channelInactive(ctx);
}
 
Example #5
Source File: CreditBasedPartitionRequestClientHandler.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
@Override
public void channelInactive(ChannelHandlerContext ctx) throws Exception {
	// Unexpected close. In normal operation, the client closes the connection after all input
	// channels have been removed. This indicates a problem with the remote task manager.
	if (!inputChannels.isEmpty()) {
		final SocketAddress remoteAddr = ctx.channel().remoteAddress();

		notifyAllChannelsOfErrorAndClose(new RemoteTransportException(
			"Connection unexpectedly closed by remote task manager '" + remoteAddr + "'. "
				+ "This might indicate that the remote task manager was lost.", remoteAddr));
	}

	super.channelInactive(ctx);
}
 
Example #6
Source File: ClientTransportErrorHandlingTest.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
/**
 * Verifies that "Connection reset by peer" Exceptions are special-cased and are reported as
 * an instance of {@link RemoteTransportException}.
 */
@Test
public void testConnectionResetByPeer() throws Throwable {
	EmbeddedChannel ch = createEmbeddedChannel();

	NetworkClientHandler handler = getClientHandler(ch);

	RemoteInputChannel rich = addInputChannel(handler);

	final Throwable[] error = new Throwable[1];

	// Verify the Exception
	doAnswer(new Answer<Void>() {
		@Override
		public Void answer(InvocationOnMock invocation) throws Throwable {
			Throwable cause = (Throwable) invocation.getArguments()[0];

			try {
				assertEquals(RemoteTransportException.class, cause.getClass());
				assertNotEquals("Connection reset by peer", cause.getMessage());

				assertEquals(IOException.class, cause.getCause().getClass());
				assertEquals("Connection reset by peer", cause.getCause().getMessage());
			}
			catch (Throwable t) {
				error[0] = t;
			}

			return null;
		}
	}).when(rich).onError(any(Throwable.class));

	ch.pipeline().fireExceptionCaught(new IOException("Connection reset by peer"));

	assertNull(error[0]);
}
 
Example #7
Source File: PartitionRequestClientHandler.java    From flink with Apache License 2.0 5 votes vote down vote up
@Override
public void channelInactive(ChannelHandlerContext ctx) throws Exception {
	// Unexpected close. In normal operation, the client closes the connection after all input
	// channels have been removed. This indicates a problem with the remote task manager.
	if (!inputChannels.isEmpty()) {
		final SocketAddress remoteAddr = ctx.channel().remoteAddress();

		notifyAllChannelsOfErrorAndClose(new RemoteTransportException(
				"Connection unexpectedly closed by remote task manager '" + remoteAddr + "'. "
						+ "This might indicate that the remote task manager was lost.",
				remoteAddr));
	}

	super.channelInactive(ctx);
}
 
Example #8
Source File: CreditBasedPartitionRequestClientHandler.java    From flink with Apache License 2.0 5 votes vote down vote up
@Override
public void channelInactive(ChannelHandlerContext ctx) throws Exception {
	// Unexpected close. In normal operation, the client closes the connection after all input
	// channels have been removed. This indicates a problem with the remote task manager.
	if (!inputChannels.isEmpty()) {
		final SocketAddress remoteAddr = ctx.channel().remoteAddress();

		notifyAllChannelsOfErrorAndClose(new RemoteTransportException(
			"Connection unexpectedly closed by remote task manager '" + remoteAddr + "'. "
				+ "This might indicate that the remote task manager was lost.", remoteAddr));
	}

	super.channelInactive(ctx);
}
 
Example #9
Source File: ClientTransportErrorHandlingTest.java    From flink with Apache License 2.0 5 votes vote down vote up
/**
 * Verifies that "Connection reset by peer" Exceptions are special-cased and are reported as
 * an instance of {@link RemoteTransportException}.
 */
@Test
public void testConnectionResetByPeer() throws Throwable {
	EmbeddedChannel ch = createEmbeddedChannel();

	NetworkClientHandler handler = getClientHandler(ch);

	RemoteInputChannel rich = addInputChannel(handler);

	final Throwable[] error = new Throwable[1];

	// Verify the Exception
	doAnswer(new Answer<Void>() {
		@Override
		public Void answer(InvocationOnMock invocation) throws Throwable {
			Throwable cause = (Throwable) invocation.getArguments()[0];

			try {
				assertEquals(RemoteTransportException.class, cause.getClass());
				assertNotEquals("Connection reset by peer", cause.getMessage());

				assertEquals(IOException.class, cause.getCause().getClass());
				assertEquals("Connection reset by peer", cause.getCause().getMessage());
			}
			catch (Throwable t) {
				error[0] = t;
			}

			return null;
		}
	}).when(rich).onError(any(Throwable.class));

	ch.pipeline().fireExceptionCaught(new IOException("Connection reset by peer"));

	assertNull(error[0]);
}
 
Example #10
Source File: CreditBasedPartitionRequestClientHandler.java    From flink with Apache License 2.0 5 votes vote down vote up
@Override
public void channelInactive(ChannelHandlerContext ctx) throws Exception {
	// Unexpected close. In normal operation, the client closes the connection after all input
	// channels have been removed. This indicates a problem with the remote task manager.
	if (!inputChannels.isEmpty()) {
		final SocketAddress remoteAddr = ctx.channel().remoteAddress();

		notifyAllChannelsOfErrorAndClose(new RemoteTransportException(
			"Connection unexpectedly closed by remote task manager '" + remoteAddr + "'. "
				+ "This might indicate that the remote task manager was lost.", remoteAddr));
	}

	super.channelInactive(ctx);
}
 
Example #11
Source File: ClientTransportErrorHandlingTest.java    From flink with Apache License 2.0 5 votes vote down vote up
/**
 * Verifies that "Connection reset by peer" Exceptions are special-cased and are reported as
 * an instance of {@link RemoteTransportException}.
 */
@Test
public void testConnectionResetByPeer() throws Throwable {
	EmbeddedChannel ch = createEmbeddedChannel();

	NetworkClientHandler handler = getClientHandler(ch);

	RemoteInputChannel rich = addInputChannel(handler);

	final Throwable[] error = new Throwable[1];

	// Verify the Exception
	doAnswer(new Answer<Void>() {
		@Override
		public Void answer(InvocationOnMock invocation) throws Throwable {
			Throwable cause = (Throwable) invocation.getArguments()[0];

			try {
				assertEquals(RemoteTransportException.class, cause.getClass());
				assertNotEquals("Connection reset by peer", cause.getMessage());

				assertEquals(IOException.class, cause.getCause().getClass());
				assertEquals("Connection reset by peer", cause.getCause().getMessage());
			}
			catch (Throwable t) {
				error[0] = t;
			}

			return null;
		}
	}).when(rich).onError(any(Throwable.class));

	ch.pipeline().fireExceptionCaught(new IOException("Connection reset by peer"));

	assertNull(error[0]);
}