Class AcknowledgedMessagesSessionExtension
- java.lang.Object
-
- org.cometd.server.ext.AcknowledgedMessagesSessionExtension
-
- All Implemented Interfaces:
java.util.EventListener
,Bayeux.BayeuxListener
,ServerSession.DeQueueListener
,ServerSession.Extension
,ServerSession.QueueListener
,ServerSession.ServerSessionListener
public class AcknowledgedMessagesSessionExtension extends java.lang.Object implements ServerSession.Extension, ServerSession.DeQueueListener, ServerSession.QueueListener
Tracks the batch id of messages sent to a client.
-
-
Constructor Summary
Constructors Constructor Description AcknowledgedMessagesSessionExtension(ServerSession session)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addListener(AcknowledgedMessagesExtension.Listener listener)
void
deQueue(ServerSession session, java.util.Queue<ServerMessage> queue)
Callback invoked to notify that the queue of messages is about to be sent to the remote client.void
deQueue(ServerSession session, java.util.Queue<ServerMessage> queue, java.util.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 void
importMessages(ServerSessionImpl session)
protected void
processBatch(long batch)
void
queued(ServerSession sender, ServerMessage message)
Callback invoked when a message is queued in the session queue.boolean
rcv(ServerSession from, ServerMessage.Mutable message)
Blocking version ofServerSession.Extension.incoming(ServerSession, ServerMessage.Mutable, Promise)
for non-meta messages.boolean
rcvMeta(ServerSession session, ServerMessage.Mutable message)
Blocking version ofServerSession.Extension.incoming(ServerSession, ServerMessage.Mutable, Promise)
for meta messages.void
removeListener(AcknowledgedMessagesExtension.Listener listener)
ServerMessage
send(ServerSession sender, ServerSession session, ServerMessage message)
Blocking version ofServerSession.Extension.outgoing(ServerSession, ServerSession, ServerMessage.Mutable, Promise)
for non-meta messages.boolean
sendMeta(ServerSession sender, ServerSession to, 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, wait
-
Methods inherited from interface org.cometd.bayeux.server.ServerSession.Extension
incoming, outgoing
-
-
-
-
Constructor Detail
-
AcknowledgedMessagesSessionExtension
public AcknowledgedMessagesSessionExtension(ServerSession session)
-
-
Method Detail
-
addListener
public void addListener(AcknowledgedMessagesExtension.Listener listener)
-
removeListener
public void removeListener(AcknowledgedMessagesExtension.Listener listener)
-
rcv
public boolean rcv(ServerSession from, 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:
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.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
-
processBatch
protected void processBatch(long batch)
-
send
public ServerMessage send(ServerSession sender, ServerSession session, ServerMessage message)
Description copied from interface:ServerSession.Extension
Blocking version of
ServerSession.Extension.outgoing(ServerSession, ServerSession, ServerMessage.Mutable, Promise)
for non-meta messages.- Specified by:
send
in 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
-
queued
public void queued(ServerSession sender, ServerMessage message)
Description copied from interface:ServerSession.QueueListener
Callback invoked when a message is queued in the session queue.
- Specified by:
queued
in interfaceServerSession.QueueListener
- Parameters:
sender
- the ServerSession that sends the message, may be null.message
- the message being queued
-
sendMeta
public boolean sendMeta(ServerSession sender, ServerSession to, ServerMessage.Mutable message)
Description copied from interface:ServerSession.Extension
Blocking version of
ServerSession.Extension.outgoing(ServerSession, ServerSession, ServerMessage.Mutable, Promise)
for meta messages.- Specified by:
sendMeta
in interfaceServerSession.Extension
- Parameters:
sender
- the session that sent the message or nullto
- the session receiving the messagemessage
- the outgoing message- Returns:
- whether message processing should continue
-
deQueue
public void deQueue(ServerSession session, java.util.Queue<ServerMessage> queue, java.util.List<ServerMessage.Mutable> replies)
Description copied from interface:ServerSession.DeQueueListener
Callback 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:
deQueue
in 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, java.util.Queue<ServerMessage> queue)
Description copied from interface:ServerSession.DeQueueListener
Callback 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:
deQueue
in interfaceServerSession.DeQueueListener
- Parameters:
session
- the session whose messages are being sentqueue
- the queue of messages to send
-
importMessages
protected void importMessages(ServerSessionImpl session)
-
-