public static int ioResult(String method, int err, NativeIoException resetCause, ClosedChannelException closedCause) throws IOException { // network stack saturated... try again later if (err == ERRNO_EAGAIN_NEGATIVE || err == ERRNO_EWOULDBLOCK_NEGATIVE) { return 0; } if (err == resetCause.expectedErr()) { throw resetCause; } if (err == ERRNO_EBADF_NEGATIVE) { throw closedCause; } if (err == ERRNO_ENOTCONN_NEGATIVE) { throw new NotYetConnectedException(); } if (err == ERRNO_ENOENT_NEGATIVE) { throw new FileNotFoundException(); } // TODO: We could even go further and use a pre-instantiated IOException for the other error codes, but for // all other errors it may be better to just include a stack trace. throw newIOException(method, err); }
public ErrorType mapNettyToOutboundErrorType(final Throwable t) { if (t instanceof ReadTimeoutException) { return READ_TIMEOUT; } if (t instanceof OriginConcurrencyExceededException) { return ORIGIN_CONCURRENCY_EXCEEDED; } if (t instanceof OriginConnectException) { return ((OriginConnectException) t).getErrorType(); } if (t instanceof OutboundException) { return ((OutboundException) t).getOutboundErrorType(); } if (t instanceof Errors.NativeIoException && Errors.ERRNO_ECONNRESET_NEGATIVE == ((Errors.NativeIoException) t).expectedErr()) { // This is a "Connection reset by peer" which we see fairly often happening when Origin servers are overloaded. LOG.warn("ERRNO_ECONNRESET_NEGATIVE mapped to RESET_CONNECTION", t); return RESET_CONNECTION; } if (t instanceof ClosedChannelException) { return RESET_CONNECTION; } final Throwable cause = t.getCause(); if (cause instanceof IllegalStateException && cause.getMessage().contains("server")) { LOG.warn("IllegalStateException mapped to NO_AVAILABLE_SERVERS", cause); return NO_AVAILABLE_SERVERS; } return OTHER; }
public static int ioResult(String method, int err, NativeIoException resetCause, ClosedChannelException closedCause) throws IOException { // network stack saturated... try again later if (err == ERRNO_EAGAIN_NEGATIVE || err == ERRNO_EWOULDBLOCK_NEGATIVE) { return 0; } if (err == resetCause.expectedErr()) { throw resetCause; } if (err == ERRNO_EBADF_NEGATIVE) { throw closedCause; } if (err == ERRNO_ENOTCONN_NEGATIVE) { throw new NotYetConnectedException(); } if (err == ERRNO_ENOENT_NEGATIVE) { throw new FileNotFoundException(); } // TODO: We could even go further and use a pre-instantiated IOException for the other error codes, but for // all other errors it may be better to just include a stack trace. throw newIOException(method, err); }
public static int ioResult(String method, int err, NativeIoException resetCause, ClosedChannelException closedCause) throws IOException { // network stack saturated... try again later if (err == ERRNO_EAGAIN_NEGATIVE || err == ERRNO_EWOULDBLOCK_NEGATIVE) { return 0; } if (err == resetCause.expectedErr()) { throw resetCause; } if (err == ERRNO_EBADF_NEGATIVE) { throw closedCause; } if (err == ERRNO_ENOTCONN_NEGATIVE) { throw new NotYetConnectedException(); } if (err == ERRNO_ENOENT_NEGATIVE) { throw new FileNotFoundException(); } // TODO: We could even go further and use a pre-instantiated IOException for the other error codes, but for // all other errors it may be better to just include a stack trace. throw newIOException(method, err); }
public static int ioResult(String method, int err, NativeIoException resetCause, ClosedChannelException closedCause) throws IOException { // network stack saturated... try again later if (err == ERRNO_EAGAIN_NEGATIVE || err == ERRNO_EWOULDBLOCK_NEGATIVE) { return 0; } if (err == resetCause.expectedErr()) { throw resetCause; } if (err == ERRNO_EBADF_NEGATIVE) { throw closedCause; } if (err == ERRNO_ENOTCONN_NEGATIVE) { throw new NotYetConnectedException(); } if (err == ERRNO_ENOENT_NEGATIVE) { throw new FileNotFoundException(); } // TODO: We could even go further and use a pre-instantiated IOException for the other error codes, but for // all other errors it may be better to just include a stack trace. throw newIOException(method, err); }
public static int ioResult(String method, int err, NativeIoException resetCause, ClosedChannelException closedCause) throws IOException { // network stack saturated... try again later if (err == ERRNO_EAGAIN_NEGATIVE || err == ERRNO_EWOULDBLOCK_NEGATIVE) { return 0; } if (err == resetCause.expectedErr()) { throw resetCause; } if (err == ERRNO_EBADF_NEGATIVE) { throw closedCause; } if (err == ERRNO_ENOTCONN_NEGATIVE) { throw new NotYetConnectedException(); } if (err == ERRNO_ENOENT_NEGATIVE) { throw new FileNotFoundException(); } // TODO: We could even go further and use a pre-instantiated IOException for the other error codes, but for // all other errors it may be better to just include a stack trace. throw newIOException(method, err); }
public static NativeIoException newIOException(String method, int err) { return new NativeIoException(method, err); }
public static NativeIoException newIOException(String method, int err) { return new NativeIoException(method, err); }
public static NativeIoException newIOException(String method, int err) { return new NativeIoException(method, err); }
public static NativeIoException newIOException(String method, int err) { return new NativeIoException(method, err); }
public static NativeIoException newConnectionResetException(String method, int errnoNegative) { NativeIoException exception = newIOException(method, errnoNegative); exception.setStackTrace(EmptyArrays.EMPTY_STACK_TRACE); return exception; }
public static NativeIoException newConnectionResetException(String method, int errnoNegative) { NativeIoException exception = newIOException(method, errnoNegative); exception.setStackTrace(EmptyArrays.EMPTY_STACK_TRACE); return exception; }
public static NativeIoException newConnectionResetException(String method, int errnoNegative) { NativeIoException exception = newIOException(method, errnoNegative); exception.setStackTrace(EmptyArrays.EMPTY_STACK_TRACE); return exception; }
private static boolean isBindException(Throwable e) { if (e instanceof BindException) return true; if (e instanceof Errors.NativeIoException) { Errors.NativeIoException nativeIoException = (Errors.NativeIoException) e; return nativeIoException.getMessage().contains("bind"); } return false; }
public static NativeIoException newConnectionResetException(String method, int errnoNegative) { NativeIoException exception = newIOException(method, errnoNegative); exception.setStackTrace(EmptyArrays.EMPTY_STACK_TRACE); return exception; }
public ErrorType mapNettyToOutboundErrorType(final Throwable t) { if (t instanceof ReadTimeoutException) { return READ_TIMEOUT; } if (t instanceof OriginConcurrencyExceededException) { return ORIGIN_CONCURRENCY_EXCEEDED; } if (t instanceof OriginConnectException) { return ((OriginConnectException) t).getErrorType(); } if (t instanceof OutboundException) { return ((OutboundException) t).getOutboundErrorType(); } if (t instanceof Errors.NativeIoException && Errors.ERRNO_ECONNRESET_NEGATIVE == ((Errors.NativeIoException) t).expectedErr()) { // This is a "Connection reset by peer" which we see fairly often happening when Origin servers are overloaded. LOG.warn("ERRNO_ECONNRESET_NEGATIVE mapped to RESET_CONNECTION", t); return RESET_CONNECTION; } if (t instanceof ClosedChannelException) { return RESET_CONNECTION; } final Throwable cause = t.getCause(); if (cause instanceof IllegalStateException && cause.getMessage().contains("server")) { LOG.warn("IllegalStateException mapped to NO_AVAILABLE_SERVERS", cause); return NO_AVAILABLE_SERVERS; } return OTHER; }
public ErrorType mapNettyToOutboundErrorType(final Throwable t) { if (t instanceof ReadTimeoutException) { return READ_TIMEOUT; } if (t instanceof OriginConcurrencyExceededException) { return ORIGIN_CONCURRENCY_EXCEEDED; } if (t instanceof OriginConnectException) { return ((OriginConnectException) t).getErrorType(); } if (t instanceof OutboundException) { return ((OutboundException) t).getOutboundErrorType(); } if (t instanceof Errors.NativeIoException && Errors.ERRNO_ECONNRESET_NEGATIVE == ((Errors.NativeIoException) t).expectedErr()) { // This is a "Connection reset by peer" which we see fairly often happening when Origin servers are overloaded. LOG.warn("ERRNO_ECONNRESET_NEGATIVE mapped to RESET_CONNECTION", t); return RESET_CONNECTION; } if (t instanceof ClosedChannelException) { return RESET_CONNECTION; } final Throwable cause = t.getCause(); if (cause instanceof IllegalStateException && cause.getMessage().contains("server")) { LOG.warn("IllegalStateException mapped to NO_AVAILABLE_SERVERS", cause); return NO_AVAILABLE_SERVERS; } return OTHER; }
public static NativeIoException newIOException(String method, int err) { return new NativeIoException(method, err); }
public static int ioResult(String method, int err, NativeIoException resetCause, ClosedChannelException closedCause) throws IOException { // network stack saturated... try again later if (err == ERRNO_EAGAIN_NEGATIVE || err == ERRNO_EWOULDBLOCK_NEGATIVE) { return 0; } if (err == resetCause.expectedErr()) { throw resetCause; } if (err == ERRNO_EBADF_NEGATIVE) { throw closedCause; } if (err == ERRNO_ENOTCONN_NEGATIVE) { throw new NotYetConnectedException(); } if (err == ERRNO_ENOENT_NEGATIVE) { throw new FileNotFoundException(); } // TODO: We could even go further and use a pre-instantiated IOException for the other error codes, but for // all other errors it may be better to just include a stack trace. throw newIOException(method, err); }
public static NativeIoException newConnectionResetException(String method, int errnoNegative) { NativeIoException exception = newIOException(method, errnoNegative); exception.setStackTrace(EmptyArrays.EMPTY_STACK_TRACE); return exception; }