public abstract class AbstractClientSession extends Object implements 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.
| Modifier and Type | Class and Description |
|---|---|
protected class |
AbstractClientSession.AbstractSessionChannel
A channel scoped to a
ClientSession. |
ClientSession.Extension, ClientSession.MessageListener| Modifier | Constructor and Description |
|---|---|
protected |
AbstractClientSession() |
| Modifier and Type | Method and Description |
|---|---|
void |
addExtension(ClientSession.Extension extension) |
void |
batch(Runnable batch) |
void |
dump(Appendable out,
String indent) |
boolean |
endBatch() |
protected void |
extendIncoming(org.cometd.bayeux.Message.Mutable message,
org.cometd.bayeux.Promise<Boolean> promise) |
protected void |
extendOutgoing(org.cometd.bayeux.Message.Mutable message,
org.cometd.bayeux.Promise<Boolean> promise) |
Object |
getAttribute(String name) |
Set<String> |
getAttributeNames() |
ClientSessionChannel |
getChannel(org.cometd.bayeux.ChannelId channelId) |
ClientSessionChannel |
getChannel(String channelName) |
protected ConcurrentMap<String,AbstractClientSession.AbstractSessionChannel> |
getChannels() |
List<ClientSession.Extension> |
getExtensions() |
protected boolean |
isBatching() |
protected abstract AbstractClientSession.AbstractSessionChannel |
newChannel(org.cometd.bayeux.ChannelId channelId) |
protected abstract org.cometd.bayeux.ChannelId |
newChannelId(String channelId) |
protected org.cometd.bayeux.Message.Mutable |
newMessage() |
protected String |
newMessageId() |
protected void |
notifyCallback(ClientSession.MessageListener callback,
org.cometd.bayeux.Message.Mutable message) |
protected void |
notifyListeners(org.cometd.bayeux.Message.Mutable message) |
void |
receive(org.cometd.bayeux.Message.Mutable message,
org.cometd.bayeux.Promise<Void> promise)
Receives a message (from the server) and process it.
|
protected void |
registerCallback(String messageId,
ClientSession.MessageListener callback) |
protected void |
registerSubscriber(String messageId,
ClientSessionChannel.MessageListener subscriber) |
void |
remoteCall(String target,
Object data,
ClientSession.MessageListener callback) |
Object |
removeAttribute(String name) |
void |
removeExtension(ClientSession.Extension extension) |
protected void |
resetSubscriptions() |
protected abstract void |
send(org.cometd.bayeux.Message.Mutable message) |
protected abstract void |
sendBatch() |
void |
setAttribute(String name,
Object value) |
void |
startBatch() |
protected ClientSession.MessageListener |
unregisterCallback(String messageId) |
protected ClientSessionChannel.MessageListener |
unregisterSubscriber(String messageId) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitdisconnect, disconnect, handshake, handshake, handshakeprotected String newMessageId()
public void addExtension(ClientSession.Extension extension)
addExtension in interface ClientSessionpublic void removeExtension(ClientSession.Extension extension)
removeExtension in interface ClientSessionpublic List<ClientSession.Extension> getExtensions()
getExtensions in interface ClientSessionprotected void extendOutgoing(org.cometd.bayeux.Message.Mutable message,
org.cometd.bayeux.Promise<Boolean> promise)
protected void extendIncoming(org.cometd.bayeux.Message.Mutable message,
org.cometd.bayeux.Promise<Boolean> promise)
protected abstract org.cometd.bayeux.ChannelId newChannelId(String channelId)
protected abstract AbstractClientSession.AbstractSessionChannel newChannel(org.cometd.bayeux.ChannelId channelId)
public ClientSessionChannel getChannel(String channelName)
getChannel in interface ClientSessionpublic ClientSessionChannel getChannel(org.cometd.bayeux.ChannelId channelId)
protected ConcurrentMap<String,AbstractClientSession.AbstractSessionChannel> getChannels()
public void startBatch()
startBatch in interface org.cometd.bayeux.Sessionprotected abstract void sendBatch()
public boolean endBatch()
endBatch in interface org.cometd.bayeux.Sessionpublic void batch(Runnable batch)
batch in interface org.cometd.bayeux.Sessionprotected boolean isBatching()
public Object getAttribute(String name)
getAttribute in interface org.cometd.bayeux.Sessionpublic Set<String> getAttributeNames()
getAttributeNames in interface org.cometd.bayeux.Sessionpublic Object removeAttribute(String name)
removeAttribute in interface org.cometd.bayeux.Sessionpublic void setAttribute(String name, Object value)
setAttribute in interface org.cometd.bayeux.Sessionpublic void remoteCall(String target, Object data, ClientSession.MessageListener callback)
remoteCall in interface ClientSessionprotected abstract void send(org.cometd.bayeux.Message.Mutable message)
protected org.cometd.bayeux.Message.Mutable newMessage()
protected void resetSubscriptions()
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 extensions
and the channel listeners.
message - the message received.promise - the promise notified of the receive processingprotected void notifyListeners(org.cometd.bayeux.Message.Mutable message)
protected void notifyCallback(ClientSession.MessageListener callback, org.cometd.bayeux.Message.Mutable message)
protected void registerCallback(String messageId, ClientSession.MessageListener callback)
protected ClientSession.MessageListener unregisterCallback(String messageId)
protected void registerSubscriber(String messageId, ClientSessionChannel.MessageListener subscriber)
protected ClientSessionChannel.MessageListener unregisterSubscriber(String messageId)
public void dump(Appendable out, String indent) throws IOException
dump in interface org.eclipse.jetty.util.component.DumpableIOExceptionCopyright © 2008–2024 The CometD Project. All rights reserved.