org.cometd.server
Class ServerSessionImpl
java.lang.Object
org.cometd.server.ServerSessionImpl
- All Implemented Interfaces:
- ServerSession, Session
public class ServerSessionImpl
- extends Object
- implements ServerSession
ServerSessionImpl
protected ServerSessionImpl(BayeuxServerImpl bayeux)
ServerSessionImpl
protected ServerSessionImpl(BayeuxServerImpl bayeux,
LocalSessionImpl localSession,
String idHint)
getUserAgent
public String getUserAgent()
- Specified by:
getUserAgent in interface ServerSession
- Returns:
- the remote user agent
setUserAgent
public void setUserAgent(String userAgent)
- Parameters:
userAgent - the remote user agent
sweep
protected void sweep(long now)
getSubscriptions
public Set<ServerChannel> getSubscriptions()
- Specified by:
getSubscriptions in interface ServerSession
addExtension
public void addExtension(ServerSession.Extension extension)
- Specified by:
addExtension in interface ServerSession
removeExtension
public void removeExtension(ServerSession.Extension extension)
- Specified by:
removeExtension in interface ServerSession
getExtensions
public List<ServerSession.Extension> getExtensions()
- Specified by:
getExtensions in interface ServerSession
batch
public void batch(Runnable batch)
- Specified by:
batch in interface Session
deliver
public void deliver(Session from,
ServerMessage.Mutable message)
- Specified by:
deliver in interface ServerSession
deliver
public void deliver(Session from,
String channelId,
Object data,
String id)
- Specified by:
deliver in interface ServerSession
doDeliver
protected void doDeliver(ServerSession from,
ServerMessage.Mutable mutable)
handshake
protected void handshake()
connect
protected void connect()
disconnect
public void disconnect()
- Specified by:
disconnect in interface Session
endBatch
public boolean endBatch()
- Specified by:
endBatch in interface Session
getLocalSession
public LocalSession getLocalSession()
- Specified by:
getLocalSession in interface ServerSession
isLocalSession
public boolean isLocalSession()
- Specified by:
isLocalSession in interface ServerSession
startBatch
public void startBatch()
- Specified by:
startBatch in interface Session
addListener
public void addListener(ServerSession.ServerSessionListener listener)
- Specified by:
addListener in interface ServerSession
getId
public String getId()
- Specified by:
getId in interface Session
getLock
public Object getLock()
getQueue
public Queue<ServerMessage> getQueue()
isQueueEmpty
public boolean isQueueEmpty()
replaceQueue
public void replaceQueue(List<ServerMessage> queue)
takeQueue
public List<ServerMessage> takeQueue()
removeListener
public void removeListener(ServerSession.ServerSessionListener listener)
- Specified by:
removeListener in interface ServerSession
setScheduler
public void setScheduler(AbstractServerTransport.Scheduler newScheduler)
flush
public void flush()
flushLazy
public void flushLazy()
cancelSchedule
public void cancelSchedule()
cancelIntervalTimeout
public void cancelIntervalTimeout()
startIntervalTimeout
public void startIntervalTimeout(long defaultInterval)
getMaxInterval
protected long getMaxInterval()
getAttribute
public Object getAttribute(String name)
- Specified by:
getAttribute in interface Session
getAttributeNames
public Set<String> getAttributeNames()
- Specified by:
getAttributeNames in interface Session
removeAttribute
public Object removeAttribute(String name)
- Specified by:
removeAttribute in interface Session
setAttribute
public void setAttribute(String name,
Object value)
- Specified by:
setAttribute in interface Session
isConnected
public boolean isConnected()
- Specified by:
isConnected in interface Session
isHandshook
public boolean isHandshook()
- Specified by:
isHandshook in interface Session
extendRecv
protected boolean extendRecv(ServerMessage.Mutable message)
extendSendMeta
protected boolean extendSendMeta(ServerMessage.Mutable message)
extendSendMessage
protected ServerMessage extendSendMessage(ServerMessage message)
reAdvise
public void reAdvise()
takeAdvice
public Map<String,Object> takeAdvice()
getTimeout
public long getTimeout()
- Specified by:
getTimeout in interface ServerSession
getInterval
public long getInterval()
- Specified by:
getInterval in interface ServerSession
setTimeout
public void setTimeout(long timeoutMS)
- Specified by:
setTimeout in interface ServerSession
setInterval
public void setInterval(long intervalMS)
- Specified by:
setInterval in interface ServerSession
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()
subscribedTo
protected void subscribedTo(ServerChannelImpl channel)
unsubscribedFrom
protected void unsubscribedFrom(ServerChannelImpl channel)
dump
protected void dump(StringBuilder b,
String indent)
toString
public String toString()
- Overrides:
toString in class Object
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)
Copyright © 2008-2012 Dojo Foundation. All Rights Reserved.