Package com.streambase.liveview.client
Class MultiConnectionListener.MultiConnectionListenerBase
java.lang.Object
com.streambase.liveview.client.MultiConnectionListener.MultiConnectionListenerBase
- All Implemented Interfaces:
MultiConnectionListener
- Enclosing interface:
- MultiConnectionListener
public static class MultiConnectionListener.MultiConnectionListenerBase
extends Object
implements MultiConnectionListener
When implmenting MultiConnectionListener, if you extend this base class you'll have version protection. If any methods are added to the
interface, then a nop method will also be added to this base class.
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.streambase.liveview.client.MultiConnectionListener
MultiConnectionListener.MultiConnectionListenerBase
-
Constructor Summary
-
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.
-
Constructor Details
-
MultiConnectionListenerBase
public MultiConnectionListenerBase()
-
-
Method Details
-
smoothFailover
public void smoothFailover(LiveViewConnectionControl failedConnection, LiveViewConnectionControl connection) Description copied from interface:MultiConnectionListener
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.- Specified by:
smoothFailover
in interfaceMultiConnectionListener
- Parameters:
failedConnection
- the connection that was lost, which was the current connectionconnection
- the new current connection, which is already up and running
-
roughFailover
Description copied from interface:MultiConnectionListener
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.- Specified by:
roughFailover
in interfaceMultiConnectionListener
-
connectionEstablished
Description copied from interface:MultiConnectionListener
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.- Specified by:
connectionEstablished
in interfaceMultiConnectionListener
isCurrent
- true if this is now the current connection.
-
secondaryConnectionLost
Description copied from interface:MultiConnectionListener
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.- Specified by:
secondaryConnectionLost
in interfaceMultiConnectionListener
-
reconnectFailed
Description copied from interface:MultiConnectionListener
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.- Specified by:
reconnectFailed
in interfaceMultiConnectionListener
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).
-