Package org.cometd.server
Class ServerSessionImpl
java.lang.Object
org.cometd.server.ServerSessionImpl
- All Implemented Interfaces:
ServerSession
,org.cometd.bayeux.Session
,org.eclipse.jetty.util.component.Dumpable
public class ServerSessionImpl extends Object implements ServerSession, org.eclipse.jetty.util.component.Dumpable
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.cometd.bayeux.server.ServerSession
ServerSession.AddListener, ServerSession.DeQueueListener, ServerSession.Extension, ServerSession.HeartBeatListener, ServerSession.MaxQueueListener, ServerSession.MessageListener, ServerSession.QueueListener, ServerSession.RemoveListener, ServerSession.ServerSessionListener
-
Field Summary
-
Constructor Summary
Constructors Constructor Description ServerSessionImpl(BayeuxServerImpl bayeux)
ServerSessionImpl(BayeuxServerImpl bayeux, LocalSessionImpl localSession, String idHint)
-
Method Summary
-
Constructor Details
-
Method Details
-
getBayeuxServer
-
getUserAgent
- Specified by:
getUserAgent
in interfaceServerSession
- Returns:
- the remote user agent
-
setUserAgent
- Parameters:
userAgent
- the remote user agent
-
getBrowserId
- Returns:
- the remote client identifier
-
setBrowserId
Sets a remote client identifier, typically a browser.
- Parameters:
browserId
- the remote client identifier
-
sweep
protected void sweep(long now) -
getSubscriptions
- Specified by:
getSubscriptions
in interfaceServerSession
-
addExtension
- Specified by:
addExtension
in interfaceServerSession
-
removeExtension
- Specified by:
removeExtension
in interfaceServerSession
-
getExtensions
- Specified by:
getExtensions
in interfaceServerSession
-
batch
- Specified by:
batch
in interfaceorg.cometd.bayeux.Session
-
deliver
public void deliver(org.cometd.bayeux.Session sender, ServerMessage.Mutable message, org.cometd.bayeux.Promise<Boolean> promise)- Specified by:
deliver
in interfaceServerSession
-
deliver
public void deliver(org.cometd.bayeux.Session sender, String channelId, Object data, org.cometd.bayeux.Promise<Boolean> promise)- Specified by:
deliver
in interfaceServerSession
-
deliver1
protected void deliver1(ServerSession sender, ServerMessage.Mutable mutable, org.cometd.bayeux.Promise<Boolean> promise) -
extendOutgoing
protected void extendOutgoing(ServerSession sender, ServerMessage.Mutable message, org.cometd.bayeux.Promise<ServerMessage.Mutable> promise) -
handshake
-
connected
protected boolean connected() -
disconnect
public void disconnect()- Specified by:
disconnect
in interfaceorg.cometd.bayeux.Session
-
startBatch
public void startBatch()- Specified by:
startBatch
in interfaceorg.cometd.bayeux.Session
-
endBatch
public boolean endBatch()- Specified by:
endBatch
in interfaceorg.cometd.bayeux.Session
-
getLocalSession
- Specified by:
getLocalSession
in interfaceServerSession
-
isLocalSession
public boolean isLocalSession()- Specified by:
isLocalSession
in interfaceServerSession
-
addListener
- Specified by:
addListener
in interfaceServerSession
-
getId
- Specified by:
getId
in interfaceorg.cometd.bayeux.Session
-
getLock
-
getQueue
-
hasNonLazyMessages
public boolean hasNonLazyMessages() -
addMessage
-
takeQueue
-
notifySuspended
-
notifyResumed
-
removeListener
- Specified by:
removeListener
in interfaceServerSession
-
getListeners
-
setScheduler
-
shouldSchedule
public boolean shouldSchedule() -
flush
public void flush() -
destroyScheduler
public void destroyScheduler() -
cancelExpiration
public void cancelExpiration(boolean metaConnect) -
scheduleExpiration
public void scheduleExpiration(long defaultInterval, long defaultMaxInterval) -
getMaxInterval
public long getMaxInterval()- Specified by:
getMaxInterval
in interfaceServerSession
-
setMaxInterval
public void setMaxInterval(long maxInterval)- Specified by:
setMaxInterval
in interfaceServerSession
-
getAttribute
- Specified by:
getAttribute
in interfaceorg.cometd.bayeux.Session
-
getAttributeNames
- Specified by:
getAttributeNames
in interfaceorg.cometd.bayeux.Session
-
removeAttribute
- Specified by:
removeAttribute
in interfaceorg.cometd.bayeux.Session
-
setAttribute
- Specified by:
setAttribute
in interfaceorg.cometd.bayeux.Session
-
isHandshook
public boolean isHandshook()- Specified by:
isHandshook
in interfaceorg.cometd.bayeux.Session
-
isConnected
public boolean isConnected()- Specified by:
isConnected
in interfaceorg.cometd.bayeux.Session
-
isDisconnected
public boolean isDisconnected() -
isTerminated
public boolean isTerminated() -
extendIncoming
protected void extendIncoming(ServerMessage.Mutable message, org.cometd.bayeux.Promise<Boolean> promise) -
reAdvise
public void reAdvise() -
takeAdvice
-
getServerTransport
- Specified by:
getServerTransport
in interfaceServerSession
-
setServerTransport
-
getTimeout
public long getTimeout()- Specified by:
getTimeout
in interfaceServerSession
-
getInterval
public long getInterval()- Specified by:
getInterval
in interfaceServerSession
-
setTimeout
public void setTimeout(long timeoutMS)- Specified by:
setTimeout
in interfaceServerSession
-
setInterval
public void setInterval(long intervalMS)- Specified by:
setInterval
in interfaceServerSession
-
isBroadcastToPublisher
public boolean isBroadcastToPublisher()- Specified by:
isBroadcastToPublisher
in interfaceServerSession
-
setBroadcastToPublisher
public void setBroadcastToPublisher(boolean value)- Specified by:
setBroadcastToPublisher
in interfaceServerSession
-
added
protected void added() -
removed
protected boolean removed(boolean timedOut)- Parameters:
timedOut
- whether the session has been timed out- Returns:
- True if the session was connected.
-
setMetaConnectDeliveryOnly
public void setMetaConnectDeliveryOnly(boolean meta)- Specified by:
setMetaConnectDeliveryOnly
in interfaceServerSession
-
isMetaConnectDeliveryOnly
public boolean isMetaConnectDeliveryOnly()- Specified by:
isMetaConnectDeliveryOnly
in interfaceServerSession
-
isAllowMessageDeliveryDuringHandshake
public boolean isAllowMessageDeliveryDuringHandshake() -
setAllowMessageDeliveryDuringHandshake
public void setAllowMessageDeliveryDuringHandshake(boolean allow) -
subscribe
-
unsubscribedFrom
-
calculateTimeout
public long calculateTimeout(long defaultTimeout) -
calculateInterval
public long calculateInterval(long defaultInterval) -
updateTransientTimeout
public void updateTransientTimeout(long timeout)Updates the transient timeout with the given value. The transient timeout is the one sent by the client, that should temporarily override the session/transport timeout, for example when the client sends {timeout:0}- Parameters:
timeout
- the value to update the timeout to- See Also:
updateTransientInterval(long)
-
updateTransientInterval
public void updateTransientInterval(long interval)Updates the transient interval with the given value. The transient interval is the one sent by the client, that should temporarily override the session/transport interval, for example when the client sends {timeout:0,interval:60000}- Parameters:
interval
- the value to update the interval to- See Also:
updateTransientTimeout(long)
-
dump
- Specified by:
dump
in interfaceorg.eclipse.jetty.util.component.Dumpable
- Throws:
IOException
-
toString
-