Package org.cometd.server.ext
Class ActivityExtension
java.lang.Object
org.cometd.server.ext.ActivityExtension
- All Implemented Interfaces:
BayeuxServer.Extension
Monitors the activity of ServerSessions and disconnects them after a period of inactivity.
The inactivity of a particular ServerSession is determined in two ways:
- Only the client is inactive, that is the client only sends periodic
/meta/connectmessages but no other messages, while the server may send messages to the client; this is configured viaActivityExtension.Activity.CLIENT - Both the client and the server are inactive, that is neither the client nor the server
send messages apart the periodic
/meta/connectmessages; this is configured viaActivityExtension.Activity.CLIENT_SERVER
When the inactivity exceeds a configurable inactive period,
the ServerSession is disconnected.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumThe possible activity to monitorstatic classMonitors the activity of a singleServerSession, disconnecting it when the max inactivity period is exceeded. -
Constructor Summary
ConstructorsConstructorDescriptionActivityExtension(ActivityExtension.Activity activity, long maxInactivityPeriod) Creates an ActivityExtension to be installed in theBayeuxServer -
Method Summary
Modifier and TypeMethodDescriptionlongprotected ServerSession.ExtensionnewSessionExtension(ServerSession session, ServerMessage handshake) Creates a newServerSession.Extensionthat monitors the activity of the givenServerSessionbooleanrcvMeta(ServerSession session, ServerMessage.Mutable message)
-
Constructor Details
-
ActivityExtension
Creates an ActivityExtension to be installed in theBayeuxServer- Parameters:
activity- the activity to monitormaxInactivityPeriod- the max inactivity period, in milliseconds
-
-
Method Details
-
getActivity
- Returns:
- the activity that is being monitored by this extension
-
getMaxInactivityPeriod
public long getMaxInactivityPeriod()- Returns:
- the max inactivity period, in milliseconds
-
rcvMeta
- Specified by:
rcvMetain interfaceBayeuxServer.Extension
-
newSessionExtension
protected ServerSession.Extension newSessionExtension(ServerSession session, ServerMessage handshake) Creates a newServerSession.Extensionthat monitors the activity of the givenServerSession- Parameters:
session- theServerSessionto monitorhandshake- the handshake message- Returns:
- a new
ServerSession.Extensionthat monitors theServerSessionactivity
-