setRetryDelay method

void setRetryDelay(
  1. int newVal
)

Setter method that sets

  1. the minimum time to wait before trying a new connection to the Server in case the previous one failed for any reason; and
  2. the maximum time to wait for a response to a request before dropping the connection and trying with a different approach.

Enforcing a delay between reconnections prevents strict loops of connection attempts when these attempts always fail immediately because of some persisting issue. This applies both to reconnections aimed at opening a new session and to reconnections aimed at attempting a recovery of the current session.
Note that the delay is calculated from the moment the effort to create a connection is made, not from the moment the failure is detected. As a consequence, when a working connection is interrupted, this timeout is usually already consumed and the new attempt can be immediate (except that ConnectionOptions.setFirstRetryMaxDelay will apply in this case). As another consequence, when a connection attempt gets no answer and times out, the new attempt will be immediate.

As a timeout on unresponsive connections, it is applied in these cases:

  • Streaming: Applied on any attempt to setup the streaming connection. If after the timeout no data has arrived on the stream connection, the client may automatically switch transport or may resort to a polling connection.
  • Polling and pre-flight requests: Applied on every connection. If after the timeout no data has arrived on the polling connection, the entire connection process restarts from scratch.

This setting imposes only a minimum delay. In order to avoid network congestion, the library may use a longer delay if the issue preventing the establishment of a session persists.

Default 4000 (4 seconds).

Lifecycle This value can be set and changed at any time.

Notification A change to this setting will be notified through a call to ClientListener.onPropertyChange with argument "retryDelay" on any ClientListener listening to the related LightstreamerClient.

  • newVal The time (in milliseconds) to wait before trying a new connection.

Throws IllegalArgumentException if a negative or zero value is configured

Implementation

external void setRetryDelay(int newVal);