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 singleServerSession
, 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
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.cometd.bayeux.server.ServerSession.Extension
incoming, outgoing
-
-
-
-
Constructor Detail
-
SessionExtension
public SessionExtension(ActivityExtension.Activity activity, long maxInactivityPeriod)
-
-
Method Detail
-
getMaxInactivityPeriod
public long getMaxInactivityPeriod()
- Returns:
- the max inactivity period, in milliseconds
-
getLastActivity
protected long getLastActivity()
- Returns:
- the last activity timestamp, in nanoseconds
-
rcv
public boolean rcv(ServerSession session, ServerMessage.Mutable message)
Description copied from interface:ServerSession.Extension
Blocking version of
ServerSession.Extension.incoming(ServerSession, ServerMessage.Mutable, Promise)
for non-meta messages.- Specified by:
rcv
in interfaceServerSession.Extension
- Parameters:
session
- the session that sent the messagemessage
- the incoming message- Returns:
- whether message processing should continue
-
rcvMeta
public boolean rcvMeta(ServerSession session, ServerMessage.Mutable message)
Description copied from interface:ServerSession.Extension
Blocking version of
ServerSession.Extension.incoming(ServerSession, ServerMessage.Mutable, Promise)
for meta messages.- Specified by:
rcvMeta
in interfaceServerSession.Extension
- Parameters:
session
- the session that sent the messagemessage
- the incoming message- Returns:
- whether message processing should continue
-
send
public ServerMessage send(ServerSession session, ServerMessage message)
Description copied from interface:ServerSession.Extension
Blocking version of
ServerSession.Extension.outgoing(ServerSession, ServerMessage.Mutable, Promise)
for non-meta messages.- Specified by:
send
in 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
public boolean sendMeta(ServerSession session, ServerMessage.Mutable message)
Description copied from interface:ServerSession.Extension
Blocking version of
ServerSession.Extension.outgoing(ServerSession, ServerMessage.Mutable, Promise)
for meta messages.- Specified by:
sendMeta
in interfaceServerSession.Extension
- Parameters:
session
- the session receiving the messagemessage
- the outgoing message- Returns:
- whether message processing should continue
-
markActive
protected void markActive()
-
isInactive
public boolean isInactive()
-
disconnect
protected void disconnect(ServerSession session)
-
-