Package org.cometd.server.ext
Class ActivityExtension.SessionExtension
java.lang.Object
org.cometd.server.ext.ActivityExtension.SessionExtension
- All Implemented Interfaces:
ServerSession.Extension
- Enclosing class:
- ActivityExtension
public static class ActivityExtension.SessionExtension extends Object implements ServerSession.Extension
Monitors the activity of a single
ServerSession
, disconnecting it
when the max inactivity period is exceeded.-
Nested Class Summary
Nested classes/interfaces inherited from interface org.cometd.bayeux.server.ServerSession.Extension
ServerSession.Extension.Adapter
-
Constructor Summary
Constructors Constructor Description SessionExtension(ActivityExtension.Activity activity, long maxInactivityPeriod)
-
Method Summary
Modifier and Type Method Description protected void
disconnect(ServerSession session)
protected long
getLastActivity()
long
getMaxInactivityPeriod()
boolean
isInactive()
protected void
markActive()
boolean
rcv(ServerSession session, ServerMessage.Mutable message)
boolean
rcvMeta(ServerSession session, ServerMessage.Mutable message)
ServerMessage
send(ServerSession session, ServerMessage message)
boolean
sendMeta(ServerSession session, ServerMessage.Mutable message)
-
Constructor Details
-
Method Details
-
getMaxInactivityPeriod
public long getMaxInactivityPeriod()- Returns:
- the max inactivity period, in milliseconds
-
getLastActivity
protected long getLastActivity()- Returns:
- the last activity timestamp, in nanoseconds
-
rcv
- Specified by:
rcv
in interfaceServerSession.Extension
-
rcvMeta
- Specified by:
rcvMeta
in interfaceServerSession.Extension
-
send
- Specified by:
send
in interfaceServerSession.Extension
-
sendMeta
- Specified by:
sendMeta
in interfaceServerSession.Extension
-
markActive
protected void markActive() -
isInactive
public boolean isInactive() -
disconnect
-