public static class ClientManager.ReconnectHandler extends Object
When implementing, be sure that you do have enough logic behind cancelling reconnect feature - even Session.close()
call will be treated just like any other disconnect resulting in reconnect.
Constructor and Description |
---|
ReconnectHandler() |
Modifier and Type | Method and Description |
---|---|
long |
getDelay()
Get reconnect delay.
|
boolean |
onConnectFailure(Exception exception)
Called when there is a connection failure.
|
boolean |
onDisconnect(CloseReason closeReason)
Called after
OnClose annotated method (or Endpoint.onClose(javax.websocket.Session, javax.websocket.CloseReason) is invoked. |
public boolean onDisconnect(CloseReason closeReason)
OnClose
annotated method (or Endpoint.onClose(javax.websocket.Session, javax.websocket.CloseReason)
is invoked.closeReason
- close reason passed to onClose method.true
is returned, client container will reconnect.public boolean onConnectFailure(Exception exception)
Type of the failure is indicated by Exception
parameter. Be cautious when implementing this method,
you might easily cause DDoS like behaviour.
exception
- Exception thrown during connection phase.true
is returned, client container will reconnect.public long getDelay()
Called after onDisconnect(CloseReason)
or onConnectFailure(Exception)
when true
is
returned. When positive value is returned, next connection attempt will be made after that number of
seconds.
Default implementation returns .
Copyright © 2012–2019 Oracle Corporation. All rights reserved.