Package org.cometd.server
Class ServerSessionImpl
- java.lang.Object
-
- org.cometd.server.ServerSessionImpl
-
- All Implemented Interfaces:
ServerSession,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.eclipse.jetty.util.component.Dumpable
org.eclipse.jetty.util.component.Dumpable.DumpableContainer
-
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
-
-
Constructor Summary
Constructors Constructor Description ServerSessionImpl(BayeuxServerImpl bayeux)ServerSessionImpl(BayeuxServerImpl bayeux, LocalSessionImpl localSession, String idHint)
-
Method Summary
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.cometd.bayeux.server.ServerSession
deliver, deliver
-
-
-
-
Constructor Detail
-
ServerSessionImpl
public ServerSessionImpl(BayeuxServerImpl bayeux)
-
ServerSessionImpl
public ServerSessionImpl(BayeuxServerImpl bayeux, LocalSessionImpl localSession, String idHint)
-
-
Method Detail
-
getBayeuxServer
public BayeuxServerImpl getBayeuxServer()
-
getUserAgent
public String getUserAgent()
- Specified by:
getUserAgentin interfaceServerSession- Returns:
- the remote user agent
-
setUserAgent
public void setUserAgent(String userAgent)
- Parameters:
userAgent- the remote user agent
-
getBrowserId
public String getBrowserId()
- Returns:
- the remote client identifier
-
setBrowserId
public void setBrowserId(String browserId)
Sets a remote client identifier, typically a browser.
- Parameters:
browserId- the remote client identifier
-
sweep
protected void sweep(long now)
-
getSubscriptions
public Set<ServerChannel> getSubscriptions()
- Specified by:
getSubscriptionsin interfaceServerSession
-
addExtension
public void addExtension(ServerSession.Extension extension)
- Specified by:
addExtensionin interfaceServerSession
-
removeExtension
public void removeExtension(ServerSession.Extension extension)
- Specified by:
removeExtensionin interfaceServerSession
-
getExtensions
public List<ServerSession.Extension> getExtensions()
- Specified by:
getExtensionsin interfaceServerSession
-
deliver
public void deliver(Session sender, ServerMessage.Mutable message, Promise<Boolean> promise)
- Specified by:
deliverin interfaceServerSession
-
deliver
public void deliver(Session sender, String channelId, Object data, Promise<Boolean> promise)
- Specified by:
deliverin interfaceServerSession
-
deliver1
protected void deliver1(ServerSession sender, ServerMessage.Mutable mutable, Promise<Boolean> promise)
-
extendOutgoing
protected void extendOutgoing(ServerMessage.Mutable message, Promise<ServerMessage.Mutable> promise)
-
handshake
protected boolean handshake(ServerMessage.Mutable message)
-
connected
protected boolean connected()
-
disconnect
public void disconnect()
- Specified by:
disconnectin interfaceSession
-
startBatch
public void startBatch()
- Specified by:
startBatchin interfaceSession
-
getLocalSession
public LocalSession getLocalSession()
- Specified by:
getLocalSessionin interfaceServerSession
-
isLocalSession
public boolean isLocalSession()
- Specified by:
isLocalSessionin interfaceServerSession
-
addListener
public void addListener(ServerSession.ServerSessionListener listener)
- Specified by:
addListenerin interfaceServerSession
-
getLock
public Object getLock()
-
getQueue
public Queue<ServerMessage> getQueue()
-
hasNonLazyMessages
public boolean hasNonLazyMessages()
-
addMessage
protected void addMessage(ServerMessage message)
-
takeQueue
public List<ServerMessage> takeQueue(List<ServerMessage.Mutable> replies)
-
notifySuspended
public void notifySuspended(ServerMessage message, long timeout)
-
notifyResumed
public void notifyResumed(ServerMessage message, boolean timeout)
-
removeListener
public void removeListener(ServerSession.ServerSessionListener listener)
- Specified by:
removeListenerin interfaceServerSession
-
getListeners
public List<ServerSession.ServerSessionListener> getListeners()
-
setScheduler
public void setScheduler(AbstractServerTransport.Scheduler newScheduler)
-
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:
getMaxIntervalin interfaceServerSession
-
setMaxInterval
public void setMaxInterval(long maxInterval)
- Specified by:
setMaxIntervalin interfaceServerSession
-
getAttribute
public Object getAttribute(String name)
- Specified by:
getAttributein interfaceSession
-
getAttributeNames
public Set<String> getAttributeNames()
- Specified by:
getAttributeNamesin interfaceSession
-
removeAttribute
public Object removeAttribute(String name)
- Specified by:
removeAttributein interfaceSession
-
setAttribute
public void setAttribute(String name, Object value)
- Specified by:
setAttributein interfaceSession
-
isHandshook
public boolean isHandshook()
- Specified by:
isHandshookin interfaceSession
-
isConnected
public boolean isConnected()
- Specified by:
isConnectedin interfaceSession
-
isDisconnected
public boolean isDisconnected()
-
isTerminated
public boolean isTerminated()
-
extendIncoming
protected void extendIncoming(ServerMessage.Mutable message, Promise<Boolean> promise)
-
reAdvise
public void reAdvise()
-
takeAdvice
public Map<String,Object> takeAdvice(ServerTransport transport)
-
getServerTransport
public ServerTransport getServerTransport()
- Specified by:
getServerTransportin interfaceServerSession
-
setServerTransport
public void setServerTransport(ServerTransport transport)
-
getTimeout
public long getTimeout()
- Specified by:
getTimeoutin interfaceServerSession
-
getInterval
public long getInterval()
- Specified by:
getIntervalin interfaceServerSession
-
setTimeout
public void setTimeout(long timeoutMS)
- Specified by:
setTimeoutin interfaceServerSession
-
setInterval
public void setInterval(long intervalMS)
- Specified by:
setIntervalin interfaceServerSession
-
isBroadcastToPublisher
public boolean isBroadcastToPublisher()
-
setBroadcastToPublisher
public void setBroadcastToPublisher(boolean value)
-
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)
-
isMetaConnectDeliveryOnly
public boolean isMetaConnectDeliveryOnly()
-
isAllowMessageDeliveryDuringHandshake
public boolean isAllowMessageDeliveryDuringHandshake()
-
setAllowMessageDeliveryDuringHandshake
public void setAllowMessageDeliveryDuringHandshake(boolean allow)
-
subscribe
protected boolean subscribe(ServerChannelImpl channel)
-
unsubscribedFrom
protected void unsubscribedFrom(ServerChannelImpl channel)
-
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
public void dump(Appendable out, String indent) throws IOException
- Specified by:
dumpin interfaceorg.eclipse.jetty.util.component.Dumpable- Throws:
IOException
-
-