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:
- It has the ability to tell BackgroundEventSource to shut down instead of reconnecting.
- If the server simply ends the stream, the
ConnectionErrorHandleris called with anEOFException;onErroris not called in this case.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic enumReturn values ofonConnectionError(Throwable)indicating what action theBackgroundEventSourceshould take after an error. -
Method Summary
Modifier and TypeMethodDescriptionThis method is called synchronously for all exceptions that occur on the socket connection (including aStreamHttpErrorExceptionif the server returns an unexpected HTTP status, orEOFExceptionif the streaming response has ended).
-
Method Details
-
onConnectionError
This method is called synchronously for all exceptions that occur on the socket connection (including aStreamHttpErrorExceptionif the server returns an unexpected HTTP status, orEOFExceptionif 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.SHUTDOWNto cause the connection to close.- Parameters:
t- aThrowableobject- Returns:
- an
ConnectionErrorHandler.Actionconstant
-