Class DefaultNetworkConfiguration

java.lang.Object
com.levigo.jadice.web.server.config.DefaultNetworkConfiguration
All Implemented Interfaces:
ServerConfiguration.NetworkConfiguration, com.levigo.jadice.web.transport.server.internal.config.ConnectionConfiguration
Direct Known Subclasses:
SpringPropertiesNetworkConfiguration

public class DefaultNetworkConfiguration extends Object implements ServerConfiguration.NetworkConfiguration
  • Constructor Details

    • DefaultNetworkConfiguration

      public DefaultNetworkConfiguration()
  • Method Details

    • setSessionTimeout

      public void setSessionTimeout(Duration sessionTimeout)
      Description copied from interface: com.levigo.jadice.web.transport.server.internal.config.ConnectionConfiguration
      Sets the time after which an idle client (that has neither sent a keep alive message, nor a normal message) is considered to be timed out.

      This value should be large enough to cover also slow networks or other bottlenecks. Typically the timeout value should be in between 30 seconds up to a minute and need to be always lager then zero.

      If a client times out, the connection is closed and a cleanup is performed for all resources connected to a client session.

      Specified by:
      setSessionTimeout in interface com.levigo.jadice.web.transport.server.internal.config.ConnectionConfiguration
      Parameters:
      sessionTimeout - the timeout value
    • setLongPollTimeout

      public void setLongPollTimeout(Duration longPollTimeout)
      Description copied from interface: com.levigo.jadice.web.transport.server.internal.config.ConnectionConfiguration
      This applies only to longpoll:

      Sets the time after a longpoll request, times out. The timeout will only kick in, if the server has no message for the client and not sent any message to the client in the meantime. If the server sent a message, the longpoll request will be answered and a new longpoll will be generated by the client.

      Specified by:
      setLongPollTimeout in interface com.levigo.jadice.web.transport.server.internal.config.ConnectionConfiguration
      Parameters:
      longPollTimeout - the time after a non-answered-longpoll operation times out
    • setWebSocketTimeout

      public void setWebSocketTimeout(Duration webSocketTimeout)
      Description copied from interface: com.levigo.jadice.web.transport.server.internal.config.ConnectionConfiguration
      This applies only to websocket:

      Sets the time after a websocket request, times out. The timeout will only kick in, if the server has no message for the client and not sent any message to the client in the meantime. If the server sent a message, the websocket request will be answered and a new websocket will be generated by the client. Caution: different app-servers sometimes handle values like 0 or Double.MAX_VALUE differently. The value 0 does not necessarily indicate the session will never timeout due to inactivity. Also some app-servers like Wildly won't accept Double.MAX_VALUE, others like Tomcat seem to add an additional duration of 5s on-top of the given value. Internally Session.setMaxIdleTimeout(long) is used.

      Specified by:
      setWebSocketTimeout in interface com.levigo.jadice.web.transport.server.internal.config.ConnectionConfiguration
      Parameters:
      webSocketTimeout - the time after a non-answered-websocket operation times out
    • setKeepAliveInterval

      public void setKeepAliveInterval(Duration interval)
      Description copied from interface: com.levigo.jadice.web.transport.server.internal.config.ConnectionConfiguration
      This applies only to longpoll and server sent events:

      Sets the interval at which a keep alive message is sent to the client so that the client knows the server and connection is still alive. Typically the value should be round about a halve minute and always larger then zero.

      Smaller values tend to flood the network, larger values tend render this functionality pointless.

      Specified by:
      setKeepAliveInterval in interface com.levigo.jadice.web.transport.server.internal.config.ConnectionConfiguration
      Parameters:
      interval - the interval
    • setResponseAggregationWindow

      public void setResponseAggregationWindow(Duration responseAggregationWindow)
      Description copied from interface: com.levigo.jadice.web.transport.server.internal.config.ConnectionConfiguration
      This applies only to longpoll:

      Sets the time window a request is held open in order to aggregate messages the server wants to send to the client. This window is only used, once the server has messages that will be sent. This results in less messages and thus less traffic, since they are sent in a batch.

      The window needs to be small, so that the answer to the client isn't delayed too long, and must be larger then zero. Typically in between 50 ms to 100 ms.

      Larger values result in a noticeable delay. Very short values (0 ms to 10ms) are likely to result in empty longpoll answers, since the server hasn't finished computing yet.

      Specified by:
      setResponseAggregationWindow in interface com.levigo.jadice.web.transport.server.internal.config.ConnectionConfiguration
      Parameters:
      responseAggregationWindow - the time window a longpoll request is delayed
    • getResponseAggregationWindow

      public Duration getResponseAggregationWindow()
      Description copied from interface: com.levigo.jadice.web.transport.server.internal.config.ConnectionConfiguration
      This applies only to longpoll:

      Gets the time window a request is held open in order to aggregate messages the server wants to send to the client. This window is only used, once the server has messages that will be sent. This results in less messages and thus less traffic, since they are sent in a batch.

      Specified by:
      getResponseAggregationWindow in interface com.levigo.jadice.web.transport.server.internal.config.ConnectionConfiguration
      Returns:
      the time window a longpoll request is delayed
    • getLongPollTimeout

      public Duration getLongPollTimeout()
      Description copied from interface: com.levigo.jadice.web.transport.server.internal.config.ConnectionConfiguration
      This applies only to longpoll:

      Get the time after a longpoll request, times out. The timeout will only kick in, if the server has no message for the client and not sent any message to the client in the meantime. If the server sent a message, the longpoll request will be answered and a new longpoll will be generated by the client.

      Specified by:
      getLongPollTimeout in interface com.levigo.jadice.web.transport.server.internal.config.ConnectionConfiguration
      Returns:
      the time after a non-answered-longpoll operation times out
    • getWebSocketTimeout

      public Duration getWebSocketTimeout()
      Description copied from interface: com.levigo.jadice.web.transport.server.internal.config.ConnectionConfiguration
      This applies only to websocket:

      Get the time after a websocket request times out. The timeout will only kick in, if the server has no message for the client and not sent any message to the client in the meantime. If the server sent a message, the websocket request will be answered and a new websocket will be generated by the client.

      Specified by:
      getWebSocketTimeout in interface com.levigo.jadice.web.transport.server.internal.config.ConnectionConfiguration
      Returns:
      the time after a non-answered-websocket operation times out. The default is 9 hours
    • getSessionTimeout

      public Duration getSessionTimeout()
      Description copied from interface: com.levigo.jadice.web.transport.server.internal.config.ConnectionConfiguration
      Gets the time after which an idle client (that has neither sent a keep alive message, nor a normal message) is considered to be timed out.

      If a client times out, the connection is closed and a cleanup is performed for all resources connected to a client session.

      Specified by:
      getSessionTimeout in interface com.levigo.jadice.web.transport.server.internal.config.ConnectionConfiguration
      Returns:
      the timeout value
    • getKeepAliveInterval

      public Duration getKeepAliveInterval()
      Description copied from interface: com.levigo.jadice.web.transport.server.internal.config.ConnectionConfiguration
      This applies only to longpoll and server sent events:

      Returns the interval at which a keep alive message is sent to the client so that the client knows the server and connection is still alive.

      Specified by:
      getKeepAliveInterval in interface com.levigo.jadice.web.transport.server.internal.config.ConnectionConfiguration
      Returns:
      the interval
    • isAlwaysCreateHttpSession

      public boolean isAlwaysCreateHttpSession()
      Description copied from interface: com.levigo.jadice.web.transport.server.internal.config.ConnectionConfiguration
      Determines if a http-session should always be created. This takes place in the TransportWebtoolkitFilter. If you do not require a http-session and the according JSESSIONID-cookie you can disable this. Defaults to true.
      Specified by:
      isAlwaysCreateHttpSession in interface com.levigo.jadice.web.transport.server.internal.config.ConnectionConfiguration
      Returns:
      true if a http-session should always be created
    • setAlwaysCreateHttpSession

      public void setAlwaysCreateHttpSession(boolean alwaysCreateHttpSession)
      Description copied from interface: com.levigo.jadice.web.transport.server.internal.config.ConnectionConfiguration
      You can set this to false if you do not want that jadice web toolkit enforces the creation of a http-session.
      Specified by:
      setAlwaysCreateHttpSession in interface com.levigo.jadice.web.transport.server.internal.config.ConnectionConfiguration
      Parameters:
      alwaysCreateHttpSession -
    • toString

      public String toString()
      Overrides:
      toString in class Object