com.lightstreamer.javameclient.midp
Interface ConnectionListener


public interface ConnectionListener

Receives notifications of connection activity and errors.


Method Summary
 void onBufferFull()
          Notification that the local buffer is full and no more data will be read until the buffer is empty.
 void onClientError(java.lang.String error)
          Notification of a Client error.
 void onServerError(java.lang.String error)
          Notification that the Server has refused a connection request because of the constraints imposed by the Metadata Adapter or by Server configuration.
 void onStatusChange(java.lang.String newStatus)
          Notification of each time the client status has changed.
 

Method Detail

onStatusChange

void onStatusChange(java.lang.String newStatus)
Notification of each time the client status has changed. Handle this event to perform actions related to connection and disconnection occurrences. NOTE: this method should not block.

Parameters:
newStatus - The current client status. It can be one of the following values:

LSClient.OFF

LSClient.CONNECTING

LSClient.POLLING

LSClient.STREAMING

LSClient.STALLED

See Also:
LSClient.getStatus()

onBufferFull

void onBufferFull()
Notification that the local buffer is full and no more data will be read until the buffer is empty. Receiving this notification too frequently indicates that there is too much data respect what the client hardware can handle.

See Also:
LSClient.setBufferMax(int), LSClient.setMaxBandwidth(int), SimpleTableInfo.setRequestedMaxFrequency(int)

onServerError

void onServerError(java.lang.String error)
Notification that the Server has refused a connection request because of the constraints imposed by the Metadata Adapter or by Server configuration. No automatic recovery attempt is performed.
Note that if single connection mode is used, the error may be caused by a problem with a table subscription, which, in this case, causes the whole session request to fail.

Parameters:
error - A string representing the error sent by the server; the string message is prefixed by a Server originated error code, to be disaggregated in a future release of the library.
See Also:
SimpleTableListener.onControlError(java.lang.String), ExtendedTableListener.onControlError(java.lang.String), HandyTableListener.onControlError(int, java.lang.String), LSClient.useSingleConnection(boolean)

onClientError

void onClientError(java.lang.String error)
Notification of a Client error. The error could be: Error conditions of these kinds don't stop the processing. In any case of an unsuccessful stream/poll attempt, the library will perform further attempts, using the timeout configured through ConnectionPolicy.setRetryTimeout(int). In any other cases of unsuccessful requests to the Server, no further attempts will be performed.
The notification is only provided for diagnostic purposes; it is not meant as a way to make specific recovery actions possible.

Parameters:
error - A string representing the error occurred.
See Also:
LSClient.setBandwidthUnlimited(), LSClient.setMaxBandwidth(int), LSClient.sendMessage(String)