Package net.sf.eBus.config
Class EConfigure.PauseBuilder
- java.lang.Object
-
- net.sf.eBus.config.EConfigure.PauseBuilder
-
- Enclosing class:
- EConfigure
public static final class EConfigure.PauseBuilder extends Object
Constructs aEConfigure.PauseConfiginstance based on the parameters set via the builder API. Configuration settings are based on the connection role. Pause duration and maximum backlog size may be set for both connection acceptor and initiator. The remaining settings (discard policy, idle time, maximum connection time, and resume-on-backlog-size) may only be set for initiators.Properties depend on the connection role. For acceptor, only the pause duration (required) and maximum backlog size (optional) may be set. For initiator, all properties may be used where pause duration and maximum connect time are required and the remaining properties are optional.
Example building a
EConfigure.PauseConfig- acceptorfinal EConfigure.PauseBuilder builder = new EConfigure.pauseBuilder(EConfigure.ConnectionRole.Acceptor); final EConfigure.PauseConfig pauseConfig = builder.duration(Duration.ofMinutes(5L) .maxBacklogSize(10) .build();Please note that the connection acceptor uses the discard policy set by the connection initiator.
Example building a
EConfigure.PauseConfig- initiatorfinal EConfigure.PauseBuilder builder = new EConfigure.pauseBuilder(EConfigure.ConnectionRole.Initiator); final EConfigure.PauseConfig pauseConfig = builder.duration(Duration.ofMinutes(5L) .maxBacklogSize(20) .discardPolicy(EConfigure.DiscardPolicy.OLDEST_FIRST) .maxConnectionTime(Duration.ofSeconds(30L)) .resumeOnBacklogSize(5) .build();
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description EConfigure.PauseConfigbuild()Returns the pause configuration created from the configured parameters.EConfigure.PauseBuilderdiscardPolicy(EConfigure.DiscardPolicy policy)Sets the backlog discard policy and returnsthispause configuration builder.EConfigure.PauseBuilderduration(Duration duration)Sets the pause duration and returnsthispause configuration builder.EConfigure.PauseBuilderidleTime(Duration duration)Sets the idle time duration and returnsthispause configuration builder.EConfigure.PauseBuildermaxBacklogSize(int size)Sets the maximum backlog size and returnsthispause configuration builder.EConfigure.PauseBuildermaxConnectionTime(Duration duration)Sets the maximum connection time duration and returnsthispause configuration builder.EConfigure.PauseBuilderresumeOnBacklogSize(int size)Sets the transmit queue limit which trigger automatic client connection resumption.
-
-
-
Method Detail
-
duration
public EConfigure.PauseBuilder duration(Duration duration)
Sets the pause duration and returnsthispause configuration builder. This value must be set for both acceptor and initiator connections.- Parameters:
duration- pause duration.- Returns:
this PauseBuilder.- Throws:
com.typesafe.config.ConfigException- ifdurationisnullor is ≤ zero.
-
maxBacklogSize
public EConfigure.PauseBuilder maxBacklogSize(int size)
Sets the maximum backlog size and returnsthispause configuration builder. This value may be set for both acceptor and initiator connections.- Parameters:
size- maximum backlog size.- Returns:
this PauseBuilder.- Throws:
com.typesafe.config.ConfigException- ifsizeis < zero.
-
discardPolicy
public EConfigure.PauseBuilder discardPolicy(EConfigure.DiscardPolicy policy)
Sets the backlog discard policy and returnsthispause configuration builder. This value may only be set for initiator connections.- Parameters:
policy- backlog overflow discard policy.- Returns:
this PauseBuilder.- Throws:
com.typesafe.config.ConfigException- if this is a acceptor connection orpolicyisnull.
-
idleTime
public EConfigure.PauseBuilder idleTime(Duration duration)
Sets the idle time duration and returnsthispause configuration builder. This value may only be set for initiator connections.- Parameters:
duration- maximum idle time duration.- Returns:
this PauseBuilder.- Throws:
com.typesafe.config.ConfigException- if this is a acceptor connection ordurationisnullor is ≤ zero.
-
maxConnectionTime
public EConfigure.PauseBuilder maxConnectionTime(Duration duration)
Sets the maximum connection time duration and returnsthispause configuration builder. This value may only be set for initiator connections.- Parameters:
duration- maximum connection time duration.- Returns:
this PauseBuilder.- Throws:
com.typesafe.config.ConfigException- if this is a acceptor connection ordurationisnullor is ≤ zero.
-
resumeOnBacklogSize
public EConfigure.PauseBuilder resumeOnBacklogSize(int size)
Sets the transmit queue limit which trigger automatic client connection resumption. Iflimitis zero then this feature is disabled. Note: the transmit queue size is based on the number of queued application messages only.This value may only be set for initiator connections.
- Parameters:
size- transmit queue size trigger connection resumption.- Returns:
this PauseBuilder.- Throws:
com.typesafe.config.ConfigException- if this is a acceptor connection orsize< zero.
-
build
public EConfigure.PauseConfig build()
Returns the pause configuration created from the configured parameters.- Returns:
- a pause configuration instance.
- Throws:
com.typesafe.config.ConfigException- if the pause configuration contains errors.
-
-