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 voiddisconnect(ServerSession session)protected longgetLastActivity()longgetMaxInactivityPeriod()booleanisInactive()protected voidmarkActive()booleanrcv(ServerSession session, ServerMessage.Mutable message)Callback method invoked every time a normal message is incoming.booleanrcvMeta(ServerSession session, ServerMessage.Mutable message)Callback method invoked every time a meta message is incoming.ServerMessagesend(ServerSession session, ServerMessage message)Callback method invoked every time a normal message is outgoing.booleansendMeta(ServerSession session, ServerMessage.Mutable message)Callback method invoked every time a meta message is outgoing.
-
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
Description copied from interface:ServerSession.ExtensionCallback method invoked every time a normal message is incoming.
- Specified by:
rcvin interfaceServerSession.Extension- Parameters:
session- the session that sent the messagemessage- the incoming message- Returns:
- true if message processing should continue, false if it should stop
-
rcvMeta
Description copied from interface:ServerSession.ExtensionCallback method invoked every time a meta message is incoming.
- Specified by:
rcvMetain interfaceServerSession.Extension- Parameters:
session- the session that is sent the messagemessage- the incoming meta message- Returns:
- true if message processing should continue, false if it should stop
-
send
Description copied from interface:ServerSession.ExtensionCallback method invoked every time a normal message is outgoing.
- Specified by:
sendin interfaceServerSession.Extension- Parameters:
session- the session receiving the messagemessage- the outgoing message- Returns:
- The message to send or null to not send the message
-
sendMeta
Description copied from interface:ServerSession.ExtensionCallback method invoked every time a meta message is outgoing.
- Specified by:
sendMetain interfaceServerSession.Extension- Parameters:
session- the session receiving the messagemessage- the outgoing meta message- Returns:
- true if message processing should continue, false if it should stop
-
markActive
protected void markActive() -
isInactive
public boolean isInactive() -
disconnect
-