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.-
Constructor Summary
ConstructorsConstructorDescriptionSessionExtension(ActivityExtension.Activity activity, long maxInactivityPeriod) -
Method Summary
Modifier and TypeMethodDescriptionprotected voiddisconnect(ServerSession session) protected longlongbooleanprotected voidbooleanrcv(ServerSession session, ServerMessage.Mutable message) Blocking version ofServerSession.Extension.incoming(ServerSession, ServerMessage.Mutable, Promise)for non-meta messages.booleanrcvMeta(ServerSession session, ServerMessage.Mutable message) Blocking version ofServerSession.Extension.incoming(ServerSession, ServerMessage.Mutable, Promise)for meta messages.send(ServerSession sender, ServerSession session, ServerMessage message) Blocking version ofServerSession.Extension.outgoing(ServerSession, ServerSession, ServerMessage.Mutable, Promise)for non-meta messages.booleansendMeta(ServerSession sender, ServerSession session, ServerMessage.Mutable message) Blocking version ofServerSession.Extension.outgoing(ServerSession, ServerSession, ServerMessage.Mutable, Promise)for meta messages.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.cometd.bayeux.server.ServerSession.Extension
incoming, outgoing
-
Constructor Details
-
SessionExtension
-
-
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.ExtensionBlocking version of
ServerSession.Extension.incoming(ServerSession, ServerMessage.Mutable, Promise)for non-meta messages.- Specified by:
rcvin interfaceServerSession.Extension- Parameters:
session- the session that sent the messagemessage- the incoming message- Returns:
- whether message processing should continue
-
rcvMeta
Description copied from interface:ServerSession.ExtensionBlocking version of
ServerSession.Extension.incoming(ServerSession, ServerMessage.Mutable, Promise)for meta messages.- Specified by:
rcvMetain interfaceServerSession.Extension- Parameters:
session- the session that sent the messagemessage- the incoming message- Returns:
- whether message processing should continue
-
send
Description copied from interface:ServerSession.ExtensionBlocking version of
ServerSession.Extension.outgoing(ServerSession, ServerSession, ServerMessage.Mutable, Promise)for non-meta messages.- Specified by:
sendin interfaceServerSession.Extension- Parameters:
sender- the session that sent the message or nullsession- 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.ExtensionBlocking version of
ServerSession.Extension.outgoing(ServerSession, ServerSession, ServerMessage.Mutable, Promise)for meta messages.- Specified by:
sendMetain interfaceServerSession.Extension- Parameters:
sender- the session that sent the message or nullsession- the session receiving the messagemessage- the outgoing message- Returns:
- whether message processing should continue
-
markActive
protected void markActive() -
isInactive
public boolean isInactive() -
disconnect
-