Search in sources :

Example 1 with TransportException

use of org.apache.flink.runtime.io.network.netty.exception.TransportException in project flink by apache.

the class PartitionRequestClientHandler method exceptionCaught.

/**
	 * Called on exceptions in the client handler pipeline.
	 *
	 * <p> Remote exceptions are received as regular payload.
	 */
@Override
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {
    if (cause instanceof TransportException) {
        notifyAllChannelsOfErrorAndClose(cause);
    } else {
        final SocketAddress remoteAddr = ctx.channel().remoteAddress();
        final TransportException tex;
        // Improve on the connection reset by peer error message
        if (cause instanceof IOException && cause.getMessage().equals("Connection reset by peer")) {
            tex = new RemoteTransportException("Lost connection to task manager '" + remoteAddr + "'. This indicates " + "that the remote task manager was lost.", remoteAddr, cause);
        } else {
            tex = new LocalTransportException(cause.getMessage(), ctx.channel().localAddress(), cause);
        }
        notifyAllChannelsOfErrorAndClose(tex);
    }
}
Also used : RemoteTransportException(org.apache.flink.runtime.io.network.netty.exception.RemoteTransportException) LocalTransportException(org.apache.flink.runtime.io.network.netty.exception.LocalTransportException) IOException(java.io.IOException) SocketAddress(java.net.SocketAddress) TransportException(org.apache.flink.runtime.io.network.netty.exception.TransportException) LocalTransportException(org.apache.flink.runtime.io.network.netty.exception.LocalTransportException) RemoteTransportException(org.apache.flink.runtime.io.network.netty.exception.RemoteTransportException)

Aggregations

IOException (java.io.IOException)1 SocketAddress (java.net.SocketAddress)1 LocalTransportException (org.apache.flink.runtime.io.network.netty.exception.LocalTransportException)1 RemoteTransportException (org.apache.flink.runtime.io.network.netty.exception.RemoteTransportException)1 TransportException (org.apache.flink.runtime.io.network.netty.exception.TransportException)1