com.streambase.liveview.client

## Class MultiConnectionConfig

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

-     public class MultiConnectionConfig
      extends Object

  Used to define a `LiveViewMultiConnection`.
  Since:
    2.0

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `MultiConnectionConfig(List<ConnectionConfig> configs, MultiConnectionListener listener)` Use this constructor if you need to configure the servers differently.
    `MultiConnectionConfig(List<String> uris, String username, String password, MultiConnectionListener listener)` Use this constructor if the servers all use the same username and password (which can be null)

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `List<ConnectionConfig>` | `getConfigs()`
    `ConnectionMode` | `getConnectionMode()`
    `MultiConnectionListener` | `getListener()`
    `int` | `getMaxRandomReconnectDelaySeconds()`
    `long` | `getRetryIntervalMillis()`
    `long` | `getTimeoutMillis()` The amount of time to consider a connection attempt failed.
    `void` | `setClientCapabilities(EnumSet<LiveViewClientCapability> capabilities)` Declare your client capabilities to be something less than the current default.
    `void` | `setConnectionMode(ConnectionMode connectionMode)`
    `void` | `setListener(MultiConnectionListener listener)`
    `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.
    `void` | `setRetryIntervalMillis(long retryIntervalMillis)` This is the wait between retry attempts.
    `void` | `setTimeoutMillis(long timeoutMillis)` The amount of time to consider a connection attempt failed.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### 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` - 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` - 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 Detail

    - #### 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:

    - #### 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` -

    - #### setClientCapabilities

          public void setClientCapabilities(EnumSet<LiveViewClientCapability> capabilities)

      Declare your client capabilities to be something less than the current default.
      Parameters:
        `capabilities` -
      See Also:
        `LiveViewClientCapability.CURRENT_LV_CLIENT_CAPABILITY`

    - #### 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

Copyright © 2015–2018 Cloud Software Group, Inc.. All rights reserved.