Package org.cometd.server
Class LocalSessionImpl
java.lang.Object
org.cometd.common.AbstractClientSession
org.cometd.server.LocalSessionImpl
- All Implemented Interfaces:
ClientSession
,LocalSession
,Session
,org.eclipse.jetty.util.component.Dumpable
public class LocalSessionImpl extends AbstractClientSession implements LocalSession
A LocalSession
implementation.
This LocalSession
implementation communicates with its
ServerSession
counterpart without any serialization.
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected class
LocalSessionImpl.LocalChannel
A channel scoped to this LocalSession.Nested classes/interfaces inherited from class org.cometd.common.AbstractClientSession
AbstractClientSession.AbstractSessionChannel
Nested classes/interfaces inherited from interface org.cometd.bayeux.client.ClientSession
ClientSession.Extension, ClientSession.MessageListener
-
Constructor Summary
Constructors Constructor Description LocalSessionImpl(BayeuxServerImpl bayeux, String idHint)
-
Method Summary
Modifier and Type Method Description void
disconnect()
void
disconnect(ClientSessionChannel.MessageListener callback)
protected void
doSend(ServerSessionImpl from, ServerMessage.Mutable message)
Sends a message to the server.String
getId()
ServerSession
getServerSession()
void
handshake()
void
handshake(Map<String,Object> template)
void
handshake(Map<String,Object> template, ClientSessionChannel.MessageListener callback)
boolean
isConnected()
boolean
isHandshook()
protected AbstractClientSession.AbstractSessionChannel
newChannel(ChannelId channelId)
protected ChannelId
newChannelId(String channelId)
protected ServerMessage.Mutable
newMessage()
void
receive(Message.Mutable message)
protected void
send(Message.Mutable message)
protected void
send(ServerSessionImpl session, ServerMessage.Mutable message)
Enqueues or sends a message to the server.protected void
sendBatch()
String
toString()
Methods inherited from class org.cometd.common.AbstractClientSession
addExtension, batch, dump, dump, endBatch, extendRcv, extendSend, getAttribute, getAttributeNames, getChannel, getChannel, getChannels, getExtensions, isBatching, newMessageId, notifyListener, notifyListeners, registerCallback, registerSubscriber, remoteCall, removeAttribute, removeExtension, resetSubscriptions, setAttribute, startBatch, unregisterCallback, unregisterSubscriber
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.cometd.bayeux.client.ClientSession
addExtension, getChannel, getExtensions, remoteCall, removeExtension
Methods inherited from interface org.cometd.bayeux.Session
batch, endBatch, getAttribute, getAttributeNames, removeAttribute, setAttribute, startBatch
-
Constructor Details
-
Method Details
-
receive
- Overrides:
receive
in classAbstractClientSession
-
newChannel
- Specified by:
newChannel
in classAbstractClientSession
-
newChannelId
- Specified by:
newChannelId
in classAbstractClientSession
-
sendBatch
protected void sendBatch()- Specified by:
sendBatch
in classAbstractClientSession
-
getServerSession
- Specified by:
getServerSession
in interfaceLocalSession
-
handshake
public void handshake()- Specified by:
handshake
in interfaceClientSession
-
handshake
- Specified by:
handshake
in interfaceClientSession
-
handshake
- Specified by:
handshake
in interfaceClientSession
-
disconnect
public void disconnect()- Specified by:
disconnect
in interfaceSession
-
disconnect
- Specified by:
disconnect
in interfaceClientSession
-
getId
-
isConnected
public boolean isConnected()- Specified by:
isConnected
in interfaceSession
-
isHandshook
public boolean isHandshook()- Specified by:
isHandshook
in interfaceSession
-
toString
-
send
- Specified by:
send
in classAbstractClientSession
-
send
Enqueues or sends a message to the server.
This method will either enqueue the message, if this session
is batching
, or perform the actual send by callingdoSend(ServerSessionImpl, ServerMessage.Mutable)
.- Parameters:
session
- The ServerSession to send as. This normally the current server session, but during handshake it is a proposed server session.message
- The message to send.
-
doSend
Sends a message to the server.
- Parameters:
from
- The ServerSession to send as. This normally the current server session, but during handshake it is a proposed server session.message
- The message to send.
-
newMessage
- Overrides:
newMessage
in classAbstractClientSession
-