Interface MultiConnectionListener

  • All Known Implementing Classes:

    public interface MultiConnectionListener
    Register your implementation of this interface if you want to be informed of all the events involved in multi-connect
    • Method Detail

      • 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.
        failedConnection - the connection that was lost, which was the current connection
        connection - the new current connection, which is already up and running
      • roughFailover

        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. 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.
        failedConnection -
      • connectionEstablished

        void connectionEstablished​(LiveViewConnectionControl connection,
                                   boolean isCurrent)
        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.
        connection -
        isCurrent - true if this is now the current connection.
      • secondaryConnectionLost

        void secondaryConnectionLost​(LiveViewConnectionControl lostConnection)
        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.
        lostConnection -
      • reconnectFailed

        void reconnectFailed​(LiveViewConnectionControl failedConnection,
                             int failureCount)
        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.
        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).