Class AbstractClientSession
java.lang.Object
org.cometd.common.AbstractClientSession
- All Implemented Interfaces:
org.cometd.bayeux.client.ClientSession, org.cometd.bayeux.Session, org.eclipse.jetty.util.component.Dumpable
public abstract class AbstractClientSession
extends Object
implements org.cometd.bayeux.client.ClientSession, org.eclipse.jetty.util.component.Dumpable
Partial implementation of ClientSession.
It handles extensions and batching, and provides utility methods to be used by subclasses.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected classA channel scoped to aClientSession.Nested classes/interfaces inherited from interface org.cometd.bayeux.client.ClientSession
org.cometd.bayeux.client.ClientSession.Extension, org.cometd.bayeux.client.ClientSession.MessageListenerNested classes/interfaces inherited from interface org.eclipse.jetty.util.component.Dumpable
org.eclipse.jetty.util.component.Dumpable.DumpableContainer, org.eclipse.jetty.util.component.Dumpable.DumpAppendable -
Field Summary
Fields inherited from interface org.eclipse.jetty.util.component.Dumpable
LEGEND -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddExtension(org.cometd.bayeux.client.ClientSession.Extension extension) voidvoiddump(Appendable out, String indent) booleanendBatch()protected voidextendIncoming(org.cometd.bayeux.Message.Mutable message, org.cometd.bayeux.Promise<Boolean> promise) protected voidextendOutgoing(org.cometd.bayeux.Message.Mutable message, org.cometd.bayeux.Promise<Boolean> promise) getAttribute(String name) org.cometd.bayeux.client.ClientSessionChannelgetChannel(String channelName) org.cometd.bayeux.client.ClientSessionChannelgetChannel(org.cometd.bayeux.ChannelId channelId) List<org.cometd.bayeux.client.ClientSession.Extension> protected booleanprotected abstract AbstractClientSession.AbstractSessionChannelnewChannel(org.cometd.bayeux.ChannelId channelId) protected abstract org.cometd.bayeux.ChannelIdnewChannelId(String channelId) protected org.cometd.bayeux.Message.Mutableprotected Stringprotected voidnotifyCallback(org.cometd.bayeux.client.ClientSession.MessageListener callback, org.cometd.bayeux.Message.Mutable message) protected voidnotifyListeners(org.cometd.bayeux.Message.Mutable message) voidReceives a message (from the server) and process it.protected voidregisterCallback(String messageId, org.cometd.bayeux.client.ClientSession.MessageListener callback) protected voidregisterSubscriber(String messageId, org.cometd.bayeux.client.ClientSessionChannel.MessageListener subscriber) voidremoteCall(String target, Object data, org.cometd.bayeux.client.ClientSession.MessageListener callback) removeAttribute(String name) voidremoveExtension(org.cometd.bayeux.client.ClientSession.Extension extension) protected voidprotected abstract voidsend(org.cometd.bayeux.Message.Mutable message) protected abstract voidvoidsetAttribute(String name, Object value) voidprotected org.cometd.bayeux.client.ClientSession.MessageListenerunregisterCallback(String messageId) protected org.cometd.bayeux.client.ClientSessionChannel.MessageListenerunregisterSubscriber(String messageId) Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.cometd.bayeux.client.ClientSession
disconnect, disconnect, handshake, handshake, handshakeMethods inherited from interface org.eclipse.jetty.util.component.Dumpable
dump, dumpSelfMethods inherited from interface org.cometd.bayeux.Session
getId, isConnected, isHandshook
-
Constructor Details
-
AbstractClientSession
protected AbstractClientSession()
-
-
Method Details
-
newMessageId
-
addExtension
public void addExtension(org.cometd.bayeux.client.ClientSession.Extension extension) - Specified by:
addExtensionin interfaceorg.cometd.bayeux.client.ClientSession
-
removeExtension
public void removeExtension(org.cometd.bayeux.client.ClientSession.Extension extension) - Specified by:
removeExtensionin interfaceorg.cometd.bayeux.client.ClientSession
-
getExtensions
- Specified by:
getExtensionsin interfaceorg.cometd.bayeux.client.ClientSession
-
extendOutgoing
protected void extendOutgoing(org.cometd.bayeux.Message.Mutable message, org.cometd.bayeux.Promise<Boolean> promise) -
extendIncoming
protected void extendIncoming(org.cometd.bayeux.Message.Mutable message, org.cometd.bayeux.Promise<Boolean> promise) -
newChannelId
-
newChannel
protected abstract AbstractClientSession.AbstractSessionChannel newChannel(org.cometd.bayeux.ChannelId channelId) -
getChannel
- Specified by:
getChannelin interfaceorg.cometd.bayeux.client.ClientSession
-
getChannel
public org.cometd.bayeux.client.ClientSessionChannel getChannel(org.cometd.bayeux.ChannelId channelId) -
getChannels
-
startBatch
public void startBatch()- Specified by:
startBatchin interfaceorg.cometd.bayeux.Session
-
sendBatch
protected abstract void sendBatch() -
endBatch
public boolean endBatch()- Specified by:
endBatchin interfaceorg.cometd.bayeux.Session
-
batch
- Specified by:
batchin interfaceorg.cometd.bayeux.Session
-
isBatching
protected boolean isBatching() -
getAttribute
-
getAttributeNames
-
removeAttribute
-
setAttribute
-
remoteCall
-
send
protected abstract void send(org.cometd.bayeux.Message.Mutable message) -
newMessage
protected org.cometd.bayeux.Message.Mutable newMessage() -
resetSubscriptions
protected void resetSubscriptions() -
receive
public void receive(org.cometd.bayeux.Message.Mutable message, org.cometd.bayeux.Promise<Void> promise) Receives a message (from the server) and process it.
Processing the message involves calling the receive
extensionsand the channellisteners.- Parameters:
message- the message received.promise- the promise notified of the receive processing
-
notifyListeners
protected void notifyListeners(org.cometd.bayeux.Message.Mutable message) -
notifyCallback
protected void notifyCallback(org.cometd.bayeux.client.ClientSession.MessageListener callback, org.cometd.bayeux.Message.Mutable message) -
registerCallback
protected void registerCallback(String messageId, org.cometd.bayeux.client.ClientSession.MessageListener callback) -
unregisterCallback
protected org.cometd.bayeux.client.ClientSession.MessageListener unregisterCallback(String messageId) -
registerSubscriber
protected void registerSubscriber(String messageId, org.cometd.bayeux.client.ClientSessionChannel.MessageListener subscriber) -
unregisterSubscriber
protected org.cometd.bayeux.client.ClientSessionChannel.MessageListener unregisterSubscriber(String messageId) -
dump
- Specified by:
dumpin interfaceorg.eclipse.jetty.util.component.Dumpable- Throws:
IOException
-