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() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitdisconnect, handshake, handshake, handshakedisconnect, getId, isConnected, isHandshookprotected 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 boolean extendSend(Message.Mutable message)
protected boolean extendRcv(Message.Mutable message)
protected abstract AbstractClientSession.AbstractSessionChannel newChannel(ChannelId channelId)
public ClientSessionChannel getChannel(String channelName)
getChannel in interface ClientSessionpublic ClientSessionChannel getChannel(ChannelId channelId)
protected ConcurrentMap<String,AbstractClientSession.AbstractSessionChannel> getChannels()
public void startBatch()
startBatch in interface Sessionprotected abstract void sendBatch()
protected boolean isBatching()
public Object getAttribute(String name)
getAttribute in interface Sessionpublic Set<String> getAttributeNames()
getAttributeNames in interface Sessionpublic Object removeAttribute(String name)
removeAttribute in interface Sessionpublic void setAttribute(String name, Object value)
setAttribute in interface Sessionpublic void remoteCall(String target, Object data, ClientSession.MessageListener callback)
remoteCall in interface ClientSessionprotected abstract void send(Message.Mutable message)
protected Message.Mutable newMessage()
protected void resetSubscriptions()
public void receive(Message.Mutable message)
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.protected void notifyListeners(Message.Mutable message)
protected void notifyListener(ClientSessionChannel.MessageListener listener, Message.Mutable message)
protected void registerCallback(String messageId, ClientSessionChannel.MessageListener callback)
protected ClientSessionChannel.MessageListener unregisterCallback(String messageId)
protected void registerSubscriber(String messageId, ClientSessionChannel.MessageListener subscriber)
protected ClientSessionChannel.MessageListener unregisterSubscriber(String messageId)
public String dump()
dump in interface org.eclipse.jetty.util.component.Dumpablepublic void dump(Appendable out, String indent) throws IOException
dump in interface org.eclipse.jetty.util.component.DumpableIOExceptionCopyright © 2008–2017 The CometD Project. All rights reserved.