Class EConfigure.PauseConfig
- java.lang.Object
-
- net.sf.eBus.config.EConfigure.PauseConfig
-
- Enclosing class:
- EConfigure
public static final class EConfigure.PauseConfig extends Object
If a remote connection is to be paused, then this is the allowed pause configuration. When defined for a connection acceptor, only the pause duration and maximum backlog size properties are used. A connection initiator has all properties used.When a connection is paused, the actual connection is dropped but all the subscriptions and advertisements are kept in place. That means that system and application messages destined for the other side are queued, ready for transmit when the connection is resumed. While all system messages are queued, the number of queued application messages may be limited. When that limit is reached, further application messages are discard as per the configured
EConfigure.DiscardPolicy.Note that for accepted connections the discard policy used when the maximum message backlog size is reached is set by the connection initiator when requesting a connection pause.
This feature is targeted for eBus-based applications running on mobile devices. Such devices cannot maintain active connections for long without overheating and draining the battery.
The pause configuration JSON properties for an eBus service are:
Service Pause JSON Properties Property Required? Type Default Description pauseTimeYes DurationNA Maximum allowed pause duration. Actual pause duration in the minimum of client and server values. maxBacklogSizeYes int≥ zeroNA Maximum allowed pending message backlog. If zero, then backlog size is unlimited. If maximum size is reached on the server side, then messages are discarded according to the client-specified discard policy.The pause configuration JSON properties for an eBus remote connection are:
Remote Connection Pause JSON Properties Property Required? Type Default Description pauseTimeYes DurationNA Maximum allowed pause duration. Actual pause duration in the minimum of client and server values. When limit is reached, connection is resumed. maxBacklogSizeYes int≥ zeroNA Maximum allowed pending message backlog. If zero, then backlog size is unlimited. If maximum size is reached on client side, then messages are discarded as per the discard policy.discardPolicyYes EConfigure.DiscardPolicyNo Message discard policy to be used on both sides, client and server. idleTimeYes DurationNA When no messages are sent in the time limit, connection is paused. maxConnectTimeYes DurationNA Maximum time a connection may remain up before being paused, regardless of message transmit rate. resumeOnBacklogSizeNo int≥ zeroZero If message backlog reaches this size, then resume connection. A zero value means that this feature is turned off. If maxBacklogSizeis > zero, then this value should be <maxBacklogSizeto be effective.Example pause config - service.
pauseTime : 10m maxBacklogSize : 50Example pause config - remote connection.
pauseTime : 5m maxBacklogSize : 100 discardPolicy : YOUNGEST_FIRST idleTime : 1m maxConnectTime : 2m resumeOnBacklogSize : 10
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description EConfigure.DiscardPolicydiscardPolicy()Returns the message discard policy used when the maximum message backlog size is breached.Durationduration()Returns the maximum allowed pause duration.DurationidleTime()Returns the amount of time wherein no messages are sent or received on the connection before the connection is paused.intmaxBacklogSize()Returns the maximum allowed message backlog size.DurationmaxConnectTime()Returns the maximum time a connection may remain up before being paused.intresumeOnQueueLimit()Returns the transmit queue limit which triggers an automatic client connection resumption.StringtoString()Returns the pause configuration as text.
-
-
-
Method Detail
-
toString
public String toString()
Returns the pause configuration as text.
-
duration
public Duration duration()
Returns the maximum allowed pause duration.- Returns:
- pause duration.
-
maxBacklogSize
public int maxBacklogSize()
Returns the maximum allowed message backlog size.- Returns:
- message backlog size.
-
discardPolicy
public EConfigure.DiscardPolicy discardPolicy()
Returns the message discard policy used when the maximum message backlog size is breached. This policy is set by the connection initiator.- Returns:
- message discard policy.
-
idleTime
public Duration idleTime()
Returns the amount of time wherein no messages are sent or received on the connection before the connection is paused.- Returns:
- connection idle time.
-
maxConnectTime
public Duration maxConnectTime()
Returns the maximum time a connection may remain up before being paused. Note that this pausing is irrespective of the message arrival or departure.- Returns:
- maximum connection time between pauses.
-
resumeOnQueueLimit
public int resumeOnQueueLimit()
Returns the transmit queue limit which triggers an automatic client connection resumption. If zero is returned, then this trigger is disabled.- Returns:
- resume on reaching transmit queue limit.
-
-