Class MultiConnectionConfig

java.lang.Object
com.streambase.liveview.client.MultiConnectionConfig

public class MultiConnectionConfig extends Object
Used to define a LiveViewMultiConnection.
Since:
2.0
  • Constructor Details

    • MultiConnectionConfig

      public MultiConnectionConfig(List<ConnectionConfig> configs, MultiConnectionListener listener)
      Use this constructor if you need to configure the servers differently. The primary use for this is if you have different username/password for the different servers, or you have any other specific settings you want to make per server.
      Parameters:
      configs - the List of ConnectionConfigs.
      listener - if you want to be notified of connection events. May be null.
    • MultiConnectionConfig

      public MultiConnectionConfig(List<String> uris, String username, String password, MultiConnectionListener listener) throws LiveViewException
      Use this constructor if the servers all use the same username and password (which can be null)
      Parameters:
      uris - the uris to the servers
      username - the username on all the servers. May be null.
      password - password on all the servers. May be null.
      listener - if you want to be notified of connection events. May be null.
      Throws:
      LiveViewException
  • Method Details

    • getConfigs

      public List<ConnectionConfig> getConfigs()
      Returns:
      the configs
    • getListener

      public MultiConnectionListener getListener()
      Returns:
      the listener (or null) that was passed in to the constructor.
    • setListener

      public void setListener(MultiConnectionListener listener)
      Parameters:
      listener - the listener to set
    • getConnectionMode

      public ConnectionMode getConnectionMode()
      Returns:
      the connectionMode. The default, if you haven't set it, is ConnectionMode.SIMULTANEOUS_CONNECT_SINGLE_ACTIVE
    • setConnectionMode

      public void setConnectionMode(ConnectionMode connectionMode)
      Parameters:
      connectionMode - the connectionMode to set
    • getTimeoutMillis

      public long getTimeoutMillis()
      The amount of time to consider a connection attempt failed. Note that non-existant servers do not cause a timeout, that state is detected almost immediately. This is relevant only to a server that has a web services layer running but is not responding. if negative, use the default, which comes from Java System property "liveview.heartbeat.wait.millis"
      Returns:
      the timeout duration in milliseconds.
    • setTimeoutMillis

      public void setTimeoutMillis(long timeoutMillis)
      The amount of time to consider a connection attempt failed. Note that non-existant servers do not cause a timeout, that state is detected immediately. This is relevant only to a server that has a web services layer running but is not responding. This is used both for preferred server initial connect, if firstServerPreferred is true, and for all connects if preConnectAlternates if false if negative, use the default, which comes from Java System property "liveview.heartbeat.wait.millis"
      Parameters:
      timeoutMillis - the timeout duration in milliseconds.
    • setClientCapabilities

      public void setClientCapabilities(EnumSet<LiveViewClientCapability> capabilities)
      Declare your client capabilities to be something less than the current default.
      Parameters:
      capabilities -
      See Also:
    • getRetryIntervalMillis

      public long getRetryIntervalMillis()
      Returns:
      the retryIntervalMillis
    • setRetryIntervalMillis

      public void setRetryIntervalMillis(long retryIntervalMillis)
      This is the wait between retry attempts. Default is 1000 ms.
      Parameters:
      retryIntervalMillis - the retryIntervalMillis to set. 10 ms is the minimum accepted.
    • getMaxRandomReconnectDelaySeconds

      public int getMaxRandomReconnectDelaySeconds()
      Returns:
      the maxRandomReconnectDelaySeconds
    • setMaxRandomReconnectDelaySeconds

      public void setMaxRandomReconnectDelaySeconds(int maxRandomReconnectDelaySeconds)
      When any connection with queries is lost, The LiveViewMultiConnection will wait a random amount of time from 0 to this value in seconds before trying to reconnect those queries to another server. The purpose is that when one server with many clients goes down, it will prevent the client from all trying to reconnect to one server all at the same time. Some clients will be delayed, rather than all clients plus the clients already connected to the secondary server being delayed.
      Parameters:
      maxRandomReconnectDelaySeconds - the maxRandomReconnectDelaySeconds to set