Interface ConnectionErrorHandler
-
public interface ConnectionErrorHandlerInterface for an object that will be notified whenBackgroundEventSourceencounters 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 Classes Modifier and Type Interface Description static classConnectionErrorHandler.ActionReturn values ofonConnectionError(Throwable)indicating what action theBackgroundEventSourceshould take after an error.
-
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 aStreamHttpErrorExceptionif the server returns an unexpected HTTP status, orEOFExceptionif the streaming response has ended).
-
-
-
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 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
-
-