Package com.streambase.liveview.client
Interface MultiConnectionListener
- All Known Implementing Classes:
MultiConnectionListener.MultiConnectionListenerBase
public interface MultiConnectionListener
Register your implementation of this interface if you want to be informed of all the events involved in multi-connect
- Since:
- 2.0
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic class
When implmenting MultiConnectionListener, if you extend this base class you'll have version protection. -
Method Summary
Modifier and TypeMethodDescriptionvoid
connectionEstablished
(LiveViewConnectionControl connection, boolean isCurrent) This will be called whenever any connection succeeds, including the very first one.void
reconnectFailed
(LiveViewConnectionControl failedConnection, int failureCount) This will be called when any attempt to make a connection fails.void
roughFailover
(LiveViewConnectionControl failedConnection) This will be called if the current server has failed and there is no other server currently connected to fail over to.void
secondaryConnectionLost
(LiveViewConnectionControl lostConnection) This will be called when one of the secondary connections has been lost.void
smoothFailover
(LiveViewConnectionControl failedConnection, LiveViewConnectionControl connection) This will be called if the current server has failed, but there is already another server ready to fail over to.
-
Method Details
-
smoothFailover
void smoothFailover(LiveViewConnectionControl failedConnection, LiveViewConnectionControl connection) This will be called if the current server has failed, but there is already another server ready to fail over to. This will be called just before the process of resubmitting all the queries to the new primary server. If you do not want the queries to be resubmitted, you can close all the queries before returning from this call. This method exists as a convenience to UI developers. Note that we could simply have connectionLost, perhaps with an isCurrent flag, followed by a connectionEstablished, but how is the UI to know what to do during the connectionLost event? At that point he wants to put up a serious message to the user if there is not going to be an immediate connectionEstablished but he doesn't want to put anything up if there is already another connection made and ready to take over.- Parameters:
failedConnection
- the connection that was lost, which was the current connectionconnection
- the new current connection, which is already up and running
-
roughFailover
This will be called if the current server has failed and there is no other server currently connected to fail over to. The system is already trying to connect to other servers in the list. However, it will not resubmit any queries until this call has completed. If you do not want the queries to be resubmitted, you can close all the queries before returning from this call.- Parameters:
failedConnection
-
-
connectionEstablished
This will be called whenever any connection succeeds, including the very first one. After a roughFailover, the first server to which a successful connection is made will become the primary, and any active queries will be resubmitted to it.- Parameters:
connection
-isCurrent
- true if this is now the current connection.
-
secondaryConnectionLost
This will be called when one of the secondary connections has been lost. Since the primary connection is still working fine this is just for information. Nothing will happen to any ongoing queries.- Parameters:
lostConnection
-
-
reconnectFailed
This will be called when any attempt to make a connection fails. Note that this is, by definition, not the primary connection, because it was already known to be in a failed state. That is, you would already have received a smoothFailover or roughFailover call if this used to be the primary connection, or you would already have received a secondaryConnectionLost if this used to be a successful secondary connection. Or you might never have connected to this server, yet.- Parameters:
failedConnection
-failureCount
- The number of times we have tried and failed to connect to this Connection, since the last successful connection to it (or since startup, if we have never successfully connected to it).
-