Class LocalSessionImpl
- All Implemented Interfaces:
ClientSession
,LocalSession
,Session
,org.eclipse.jetty.util.component.Dumpable
A LocalSession
implementation.
This LocalSession
implementation communicates with its
ServerSession
counterpart without any serialization.
-
Nested Class Summary
Modifier and TypeClassDescriptionprotected class
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
Nested classes/interfaces inherited from interface org.eclipse.jetty.util.component.Dumpable
org.eclipse.jetty.util.component.Dumpable.DumpableContainer
-
Field Summary
Fields inherited from interface org.eclipse.jetty.util.component.Dumpable
KEY
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
disconnect
(ClientSession.MessageListener callback) Disconnects this session, ending the link between the client and the server peers.getId()
The clientId of the session.void
handshake
(Map<String, Object> template, ClientSession.MessageListener callback) Initiates the bayeux protocol handshake with the server(s).boolean
A connected session is a session where the link between the client and the server has been established.boolean
A handshook session is a session where the handshake has successfully completednewChannel
(ChannelId channelId) protected ChannelId
newChannelId
(String channelId) protected ServerMessage.Mutable
void
receive
(Message.Mutable message, Promise<Void> promise) Receives a message (from the server) and process it.protected void
send
(Message.Mutable message) protected void
send
(ServerSessionImpl session, ServerMessage.Mutable message) Enqueues or sends a message to the server.protected void
toString()
Methods inherited from class org.cometd.common.AbstractClientSession
addExtension, batch, dump, endBatch, extendIncoming, extendOutgoing, getAttribute, getAttributeNames, getChannel, getChannel, getChannels, getExtensions, isBatching, newMessageId, notifyCallback, 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, disconnect, getChannel, getExtensions, handshake, handshake, remoteCall, removeExtension
Methods inherited from interface org.eclipse.jetty.util.component.Dumpable
dump, dumpSelf
Methods inherited from interface org.cometd.bayeux.Session
batch, endBatch, getAttribute, getAttributeNames, removeAttribute, setAttribute, startBatch
-
Constructor Details
-
LocalSessionImpl
-
-
Method Details
-
receive
Description copied from class:AbstractClientSession
Receives a message (from the server) and process it.
Processing the message involves calling the receive
extensions
and the channellisteners
.- Overrides:
receive
in classAbstractClientSession
- Parameters:
message
- the message received.promise
- the promise notified of the receive processing
-
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
- Returns:
- the associated
ServerSession
-
handshake
Description copied from interface:ClientSession
Initiates the bayeux protocol handshake with the server(s).
The handshake initiated by this method is asynchronous and does not wait for the handshake response.
- Specified by:
handshake
in interfaceClientSession
- Parameters:
template
- additional fields to add to the handshake message.callback
- the message listener to notify of the handshake result
-
disconnect
Description copied from interface:ClientSession
Disconnects this session, ending the link between the client and the server peers.
- Specified by:
disconnect
in interfaceClientSession
- Parameters:
callback
- the message listener to notify of the disconnect result
-
getId
Description copied from interface:Session
The clientId of the session.
This would more correctly be called a "sessionId", but for backwards compatibility with the Bayeux protocol, it is a field called "clientId" that identifies a session.
-
isConnected
public boolean isConnected()Description copied from interface:Session
A connected session is a session where the link between the client and the server has been established.
- Specified by:
isConnected
in interfaceSession
- Returns:
- whether the session is connected
- See Also:
-
isHandshook
public boolean isHandshook()Description copied from interface:Session
A handshook session is a session where the handshake has successfully completed
- Specified by:
isHandshook
in interfaceSession
- Returns:
- whether the session is handshook
-
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 send immediately.- 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.
-
newMessage
- Overrides:
newMessage
in classAbstractClientSession
-