Interface ErrorHandler<REQ,RESP>

Type Parameters:
REQ - the request message type
RESP - the response message type

public interface ErrorHandler<REQ,RESP>
Handles channel errors.

The default implementation returns true, which stops the channel (closes the transport) on the first error. Override and return false for specific errors you wish to tolerate — for example, transient I/O errors on a connection you want to keep alive.

Note: This handler covers errors in the read and write loops, including exceptions thrown by a RequestHandler. Only Error subclasses (e.g. OutOfMemoryError) bypass this handler and are caught by the channel's outer safety net, which closes the transport unconditionally.

  • Method Summary

    Modifier and Type
    Method
    Description
    default boolean
    stopOnError(Channel channel, ErrorContext<REQ,RESP> context)
    Called when an error occurs on the channel.
  • Method Details

    • stopOnError

      default boolean stopOnError(Channel channel, ErrorContext<REQ,RESP> context)
      Called when an error occurs on the channel. Return true to stop the channel (close transport); false to continue processing.
      Parameters:
      channel - the channel on which the error occurred
      context - the error context
      Returns:
      true to stop, false to continue