Interface ConnectionErrorHandler


  • public interface ConnectionErrorHandler
    Interface for an object that will be notified when BackgroundEventSource encounters a network error or receives an error response.

    This is different from BackgroundEventHandler.onError(Throwable) in two ways:

    1. It has the ability to tell BackgroundEventSource to shut down instead of reconnecting.
    2. If the server simply ends the stream, the ConnectionErrorHandler is called with an EOFException; onError is not called in this case.
    • Method Detail

      • onConnectionError

        ConnectionErrorHandler.Action onConnectionError​(java.lang.Throwable t)
        This method is called synchronously for all exceptions that occur on the socket connection (including a StreamHttpErrorException if the server returns an unexpected HTTP status, or EOFException if the streaming response has ended).

        It must not take any direct action to affect the state of the connection, nor do any I/O of its own, but it can return ConnectionErrorHandler.Action.SHUTDOWN to cause the connection to close.

        Parameters:
        t - a Throwable object
        Returns:
        an ConnectionErrorHandler.Action constant