public class ActivityExtension extends BayeuxServer.Extension.Adapter
Monitors the activity of ServerSession
s and disconnects them after a period of inactivity.
The inactivity of a particular ServerSession
is determined in two ways:
/meta/connect
messages but no other messages, while the server may send messages to the client; this is
configured via ActivityExtension.Activity.CLIENT
/meta/connect
messages; this is configured via
ActivityExtension.Activity.CLIENT_SERVER
When the inactivity exceeds a configurable inactive period
,
the ServerSession
is disconnected
.
Modifier and Type | Class and Description |
---|---|
static class |
ActivityExtension.Activity
The possible activity to monitor
|
static class |
ActivityExtension.SessionExtension
Monitors the activity of a single
ServerSession , disconnecting it
when the max inactivity period is exceeded. |
BayeuxServer.Extension.Adapter
Constructor and Description |
---|
ActivityExtension(ActivityExtension.Activity activity,
long maxInactivityPeriod)
Creates a
ActivityExtension to be installed in the BayeuxServer |
Modifier and Type | Method and Description |
---|---|
ActivityExtension.Activity |
getActivity() |
long |
getMaxInactivityPeriod() |
protected ServerSession.Extension |
newSessionExtension(ServerSession session,
ServerMessage handshakeReply)
Creates a new
ServerSession.Extension that monitors the activity of the given ServerSession |
boolean |
sendMeta(ServerSession to,
ServerMessage.Mutable message) |
rcv, rcvMeta, send
public ActivityExtension(ActivityExtension.Activity activity, long maxInactivityPeriod)
ActivityExtension
to be installed in the BayeuxServer
activity
- the activity to monitormaxInactivityPeriod
- the max inactivity period, in millisecondspublic ActivityExtension.Activity getActivity()
public long getMaxInactivityPeriod()
public boolean sendMeta(ServerSession to, ServerMessage.Mutable message)
sendMeta
in interface BayeuxServer.Extension
sendMeta
in class BayeuxServer.Extension.Adapter
protected ServerSession.Extension newSessionExtension(ServerSession session, ServerMessage handshakeReply)
ServerSession.Extension
that monitors the activity of the given ServerSession
session
- the ServerSession
to monitorhandshakeReply
- the handshake reply messageServerSession.Extension
that monitors the ServerSession
activityCopyright © 2008–2016 The CometD Project. All rights reserved.