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, wait
disconnect, handshake, handshake, handshake
disconnect, getId, isConnected, isHandshook
protected String newMessageId()
public void addExtension(ClientSession.Extension extension)
addExtension
in interface ClientSession
public void removeExtension(ClientSession.Extension extension)
removeExtension
in interface ClientSession
public List<ClientSession.Extension> getExtensions()
getExtensions
in interface ClientSession
protected 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 ClientSession
public ClientSessionChannel getChannel(ChannelId channelId)
protected ConcurrentMap<String,AbstractClientSession.AbstractSessionChannel> getChannels()
public void startBatch()
startBatch
in interface Session
protected abstract void sendBatch()
protected boolean isBatching()
public Object getAttribute(String name)
getAttribute
in interface Session
public Set<String> getAttributeNames()
getAttributeNames
in interface Session
public Object removeAttribute(String name)
removeAttribute
in interface Session
public void setAttribute(String name, Object value)
setAttribute
in interface Session
public void remoteCall(String target, Object data, ClientSession.MessageListener callback)
remoteCall
in interface ClientSession
protected 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.Dumpable
public void dump(Appendable out, String indent) throws IOException
dump
in interface org.eclipse.jetty.util.component.Dumpable
IOException
Copyright © 2008–2016 The CometD Project. All rights reserved.