Package com.launchdarkly.eventsource
Interface ConnectionErrorHandler
-
public interface ConnectionErrorHandlerInterface for an object that will be notified when EventSource encounters a socket connection error or receives an error response. This is different fromEventHandler.onError(Throwable)in two ways:- It has the ability to tell EventSource 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 Classes Modifier and Type Interface Description static classConnectionErrorHandler.ActionReturn values ofonConnectionError(Throwable)indicating what action theEventSourceshould take after an error.
-
Field Summary
Fields Modifier and Type Field Description static ConnectionErrorHandlerDEFAULTDefault handler that does nothing.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description ConnectionErrorHandler.ActiononConnectionError(java.lang.Throwable t)This method is called synchronously for all exceptions that occur on the socket connection (including anUnsuccessfulResponseExceptionif the server returns an unexpected HTTP status, orEOFExceptionif the streaming response has ended).
-
-
-
Field Detail
-
DEFAULT
static final ConnectionErrorHandler DEFAULT
Default handler that does nothing.
-
-
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 anUnsuccessfulResponseExceptionif 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
-
-