Class AcknowledgedMessagesSessionExtension
- java.lang.Object
-
- org.cometd.server.ext.AcknowledgedMessagesSessionExtension
-
- All Implemented Interfaces:
EventListener,Bayeux.BayeuxListener,ServerSession.DeQueueListener,ServerSession.Extension,ServerSession.QueueListener,ServerSession.ServerSessionListener
public class AcknowledgedMessagesSessionExtension extends Object implements ServerSession.Extension, ServerSession.DeQueueListener, ServerSession.QueueListener
Tracks the batch id of messages sent to a client.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.cometd.bayeux.server.ServerSession.Extension
ServerSession.Extension.Adapter
-
-
Constructor Summary
Constructors Constructor Description AcknowledgedMessagesSessionExtension(ServerSession session)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddeQueue(ServerSession session, Queue<ServerMessage> queue)Callback invoked to notify that the queue of messages is about to be sent to the remote client.voiddeQueue(ServerSession session, Queue<ServerMessage> queue, List<ServerMessage.Mutable> replies)Callback invoked to notify that the queue of messages and the message replies are about to be sent to the remote client.protected voidimportMessages(ServerSessionImpl session)protected voidprocessBatch(long batch)voidqueued(ServerSession sender, ServerMessage message)Callback invoked when a message is queued in the session queue.booleanrcv(ServerSession from, 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.ServerMessagesend(ServerSession session, ServerMessage message)Blocking version ofServerSession.Extension.outgoing(ServerSession, ServerMessage.Mutable, Promise)for non-meta messages.booleansendMeta(ServerSession to, ServerMessage.Mutable message)Blocking version ofServerSession.Extension.outgoing(ServerSession, ServerMessage.Mutable, Promise)for meta messages.-
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
-
AcknowledgedMessagesSessionExtension
public AcknowledgedMessagesSessionExtension(ServerSession session)
-
-
Method Detail
-
rcv
public boolean rcv(ServerSession from, ServerMessage.Mutable message)
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:
from- 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.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
-
processBatch
protected void processBatch(long batch)
-
send
public ServerMessage send(ServerSession session, ServerMessage message)
Description copied from interface:ServerSession.ExtensionBlocking version of
ServerSession.Extension.outgoing(ServerSession, ServerMessage.Mutable, Promise)for non-meta messages.- 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
-
queued
public void queued(ServerSession sender, ServerMessage message)
Description copied from interface:ServerSession.QueueListenerCallback invoked when a message is queued in the session queue.
- Specified by:
queuedin interfaceServerSession.QueueListener- Parameters:
sender- the ServerSession that sends the message, may be null.message- the message being queued
-
sendMeta
public boolean sendMeta(ServerSession to, ServerMessage.Mutable message)
Description copied from interface:ServerSession.ExtensionBlocking version of
ServerSession.Extension.outgoing(ServerSession, ServerMessage.Mutable, Promise)for meta messages.- Specified by:
sendMetain interfaceServerSession.Extension- Parameters:
to- the session receiving the messagemessage- the outgoing message- Returns:
- whether message processing should continue
-
deQueue
public void deQueue(ServerSession session, Queue<ServerMessage> queue, List<ServerMessage.Mutable> replies)
Description copied from interface:ServerSession.DeQueueListenerCallback invoked to notify that the queue of messages and the message replies are about to be sent to the remote client.
This is the last chance to process the queue, to remove duplicates or merge messages, and to process the replies.
- Specified by:
deQueuein interfaceServerSession.DeQueueListener- Parameters:
session- the session whose messages are being sentqueue- the queue of messages to sendreplies- the message replies to send
-
deQueue
public void deQueue(ServerSession session, Queue<ServerMessage> queue)
Description copied from interface:ServerSession.DeQueueListenerCallback invoked to notify that the queue of messages is about to be sent to the remote client.
This is the last chance to process the queue and remove duplicates or merge messages.
- Specified by:
deQueuein interfaceServerSession.DeQueueListener- Parameters:
session- the session whose messages are being sentqueue- the queue of messages to send
-
importMessages
protected void importMessages(ServerSessionImpl session)
-
-