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.eclipse.jetty.util.component.Dumpable
org.eclipse.jetty.util.component.Dumpable.DumpableContainer
Nested classes/interfaces inherited from interface org.cometd.bayeux.server.ServerSession
ServerSession.AddedListener, ServerSession.DeQueueListener, ServerSession.Extension, ServerSession.HeartBeatListener, ServerSession.MessageListener, ServerSession.QueueListener, ServerSession.QueueMaxedListener, ServerSession.RemovedListener, ServerSession.ServerSessionListener
-
Field Summary
Fields inherited from interface org.eclipse.jetty.util.component.Dumpable
KEY
-
Constructor Summary
ConstructorsConstructorDescriptionServerSessionImpl(BayeuxServerImpl bayeux)
ServerSessionImpl(BayeuxServerImpl bayeux, LocalSessionImpl localSession, String idHint)
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addExtension(ServerSession.Extension extension)
void
addListener(ServerSession.ServerSessionListener listener)
protected void
addMessage(ServerMessage message)
void
long
calculateInterval(long defaultInterval)
long
calculateTimeout(long defaultTimeout)
void
cancelExpiration(boolean metaConnect)
protected boolean
void
deliver(org.cometd.bayeux.Session sender, String channelId, Object data, org.cometd.bayeux.Promise<Boolean> promise)
void
deliver(org.cometd.bayeux.Session sender, ServerMessage.Mutable message, org.cometd.bayeux.Promise<Boolean> promise)
protected void
deliver1(ServerSession sender, ServerMessage.Mutable mutable, org.cometd.bayeux.Promise<Boolean> promise)
void
void
void
dump(Appendable out, String indent)
boolean
endBatch()
protected void
extendIncoming(ServerMessage.Mutable message, org.cometd.bayeux.Promise<Boolean> promise)
protected void
extendOutgoing(ServerSession sender, ServerMessage.Mutable message, org.cometd.bayeux.Promise<ServerMessage.Mutable> promise)
void
flush()
getAttribute(String name)
getId()
long
getLock()
long
getQueue()
long
protected boolean
handshake(ServerMessage.Mutable message)
boolean
boolean
boolean
boolean
boolean
boolean
boolean
boolean
boolean
void
notifyResumed(ServerMessage message, boolean timeout)
void
notifySuspended(ServerMessage message, long timeout)
void
reAdvise()
removeAttribute(String name)
protected boolean
removed(ServerMessage message, boolean timeout)
void
removeExtension(ServerSession.Extension extension)
void
void
scheduleExpiration(long defaultInterval, long defaultMaxInterval, long metaConnectCycle)
void
setAllowMessageDeliveryDuringHandshake(boolean allow)
void
setAttribute(String name, Object value)
void
setBroadcastToPublisher(boolean value)
void
setBrowserId(String browserId)
Sets a remote client identifier, typically a browser.void
setInterval(long intervalMS)
void
setMaxInterval(long maxInterval)
void
setMetaConnectDeliveryOnly(boolean meta)
void
setScheduler(AbstractServerTransport.Scheduler newScheduler)
void
setServerTransport(ServerTransport transport)
void
setTimeout(long timeoutMS)
void
setUserAgent(String userAgent)
boolean
void
protected boolean
subscribe(ServerChannelImpl channel)
protected void
sweep(long now)
takeAdvice(ServerTransport transport)
takeQueue(List<ServerMessage.Mutable> replies)
toString()
protected void
unsubscribedFrom(ServerChannelImpl channel)
void
updateTransientInterval(long interval)
Updates the transient interval with the given value.void
updateTransientTimeout(long timeout)
Updates the transient timeout with the given value.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.eclipse.jetty.util.component.Dumpable
dump, dumpSelf
-
Constructor Details
-
ServerSessionImpl
-
ServerSessionImpl
-
-
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, long metaConnectCycle) -
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
-
removed
- Parameters:
message
- the message that caused the removal, or nulltimeout
- whether the session has been removed due a timeout- 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
-