Class ServerSessionImpl
java.lang.Object
org.cometd.server.ServerSessionImpl
- All Implemented Interfaces:
org.cometd.bayeux.server.ServerSession, org.cometd.bayeux.Session, org.eclipse.jetty.util.component.Dumpable
public class ServerSessionImpl
extends Object
implements org.cometd.bayeux.server.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.DumpableContainerNested classes/interfaces inherited from interface org.cometd.bayeux.server.ServerSession
org.cometd.bayeux.server.ServerSession.AddedListener, org.cometd.bayeux.server.ServerSession.DeQueueListener, org.cometd.bayeux.server.ServerSession.Extension, org.cometd.bayeux.server.ServerSession.HeartBeatListener, org.cometd.bayeux.server.ServerSession.MessageListener, org.cometd.bayeux.server.ServerSession.QueueListener, org.cometd.bayeux.server.ServerSession.QueueMaxedListener, org.cometd.bayeux.server.ServerSession.RemovedListener, org.cometd.bayeux.server.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 TypeMethodDescriptionvoidaddExtension(org.cometd.bayeux.server.ServerSession.Extension extension) voidaddListener(org.cometd.bayeux.server.ServerSession.ServerSessionListener listener) protected voidaddMessage(org.cometd.bayeux.server.ServerMessage message) voidlongcalculateInterval(long defaultInterval) longcalculateTimeout(long defaultTimeout) voidcancelExpiration(boolean metaConnect) booleanvoiddeliver(org.cometd.bayeux.Session sender, String channelId, Object data, org.cometd.bayeux.Promise<Boolean> promise) voiddeliver(org.cometd.bayeux.Session sender, org.cometd.bayeux.server.ServerMessage.Mutable message, org.cometd.bayeux.Promise<Boolean> promise) protected voiddeliver1(org.cometd.bayeux.server.ServerSession sender, org.cometd.bayeux.server.ServerMessage.Mutable mutable, org.cometd.bayeux.Promise<Boolean> promise) voidvoidvoiddump(Appendable out, String indent) booleanendBatch()protected voidextendIncoming(org.cometd.bayeux.server.ServerMessage.Mutable message, org.cometd.bayeux.Promise<Boolean> promise) protected voidextendOutgoing(org.cometd.bayeux.server.ServerSession sender, org.cometd.bayeux.server.ServerMessage.Mutable message, org.cometd.bayeux.Promise<org.cometd.bayeux.server.ServerMessage.Mutable> promise) voidflush()getAttribute(String name) List<org.cometd.bayeux.server.ServerSession.Extension> getId()longlongList<org.cometd.bayeux.server.ServerSession.ServerSessionListener> org.cometd.bayeux.server.LocalSessiongetLock()longlongQueue<org.cometd.bayeux.server.ServerMessage> getQueue()org.cometd.bayeux.server.ServerTransportSet<org.cometd.bayeux.server.ServerChannel> longbooleanhandshake(org.cometd.bayeux.server.ServerMessage.Mutable message) booleanbooleanbooleanbooleanbooleanbooleanbooleanbooleanbooleanvoidnotifyResumed(org.cometd.bayeux.server.ServerMessage message, boolean timeout) voidnotifySuspended(org.cometd.bayeux.server.ServerMessage message, long timeout) voidreAdvise()removeAttribute(String name) protected booleanremoved(org.cometd.bayeux.server.ServerMessage message, boolean timeout) voidremoveExtension(org.cometd.bayeux.server.ServerSession.Extension extension) voidremoveListener(org.cometd.bayeux.server.ServerSession.ServerSessionListener listener) voidscheduleExpiration(long defaultInterval, long defaultMaxInterval, long metaConnectCycle) voidsetAllowMessageDeliveryDuringHandshake(boolean allow) voidsetAttribute(String name, Object value) voidsetBroadcastToPublisher(boolean value) voidsetBrowserId(String browserId) Sets a remote client identifier, typically a browser.voidsetInterval(long intervalMS) voidsetMaxInterval(long maxInterval) voidsetMetaConnectDeliveryOnly(boolean meta) voidsetScheduler(AbstractServerTransport.Scheduler newScheduler) voidsetServerTransport(org.cometd.bayeux.server.ServerTransport transport) voidsetTimeout(long timeoutMS) voidsetUserAgent(String userAgent) booleanvoidprotected booleansubscribe(ServerChannelImpl channel) protected booleansweep(long now) takeAdvice(org.cometd.bayeux.server.ServerTransport transport) List<org.cometd.bayeux.server.ServerMessage> toString()protected voidunsubscribedFrom(ServerChannelImpl channel) booleanupdateServerEndPoint(Object newEndPoint) voidupdateTransientInterval(long interval) Updates the transient interval with the given value.voidupdateTransientTimeout(long timeout) Updates the transient timeout with the given value.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.eclipse.jetty.util.component.Dumpable
dump, dumpSelf
-
Constructor Details
-
ServerSessionImpl
-
ServerSessionImpl
-
-
Method Details
-
getBayeuxServer
-
getUserAgent
- Specified by:
getUserAgentin interfaceorg.cometd.bayeux.server.ServerSession- 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 boolean sweep(long now) -
getSubscriptions
- Specified by:
getSubscriptionsin interfaceorg.cometd.bayeux.server.ServerSession
-
addExtension
public void addExtension(org.cometd.bayeux.server.ServerSession.Extension extension) - Specified by:
addExtensionin interfaceorg.cometd.bayeux.server.ServerSession
-
removeExtension
public void removeExtension(org.cometd.bayeux.server.ServerSession.Extension extension) - Specified by:
removeExtensionin interfaceorg.cometd.bayeux.server.ServerSession
-
getExtensions
- Specified by:
getExtensionsin interfaceorg.cometd.bayeux.server.ServerSession
-
batch
- Specified by:
batchin interfaceorg.cometd.bayeux.Session
-
deliver
public void deliver(org.cometd.bayeux.Session sender, org.cometd.bayeux.server.ServerMessage.Mutable message, org.cometd.bayeux.Promise<Boolean> promise) - Specified by:
deliverin interfaceorg.cometd.bayeux.server.ServerSession
-
deliver
-
deliver1
protected void deliver1(org.cometd.bayeux.server.ServerSession sender, org.cometd.bayeux.server.ServerMessage.Mutable mutable, org.cometd.bayeux.Promise<Boolean> promise) -
extendOutgoing
protected void extendOutgoing(org.cometd.bayeux.server.ServerSession sender, org.cometd.bayeux.server.ServerMessage.Mutable message, org.cometd.bayeux.Promise<org.cometd.bayeux.server.ServerMessage.Mutable> promise) -
handshake
public boolean handshake(org.cometd.bayeux.server.ServerMessage.Mutable message) -
connected
public boolean connected() -
disconnect
public void disconnect()- Specified by:
disconnectin interfaceorg.cometd.bayeux.Session
-
startBatch
public void startBatch()- Specified by:
startBatchin interfaceorg.cometd.bayeux.Session
-
endBatch
public boolean endBatch()- Specified by:
endBatchin interfaceorg.cometd.bayeux.Session
-
getLocalSession
public org.cometd.bayeux.server.LocalSession getLocalSession()- Specified by:
getLocalSessionin interfaceorg.cometd.bayeux.server.ServerSession
-
isLocalSession
public boolean isLocalSession()- Specified by:
isLocalSessionin interfaceorg.cometd.bayeux.server.ServerSession
-
addListener
public void addListener(org.cometd.bayeux.server.ServerSession.ServerSessionListener listener) - Specified by:
addListenerin interfaceorg.cometd.bayeux.server.ServerSession
-
getId
- Specified by:
getIdin interfaceorg.cometd.bayeux.Session
-
getLock
-
getQueue
-
hasNonLazyMessages
public boolean hasNonLazyMessages() -
addMessage
protected void addMessage(org.cometd.bayeux.server.ServerMessage message) -
takeQueue
-
notifySuspended
public void notifySuspended(org.cometd.bayeux.server.ServerMessage message, long timeout) -
notifyResumed
public void notifyResumed(org.cometd.bayeux.server.ServerMessage message, boolean timeout) -
removeListener
public void removeListener(org.cometd.bayeux.server.ServerSession.ServerSessionListener listener) - Specified by:
removeListenerin interfaceorg.cometd.bayeux.server.ServerSession
-
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) -
getMetaConnectCycle
public long getMetaConnectCycle() -
getMaxInterval
public long getMaxInterval()- Specified by:
getMaxIntervalin interfaceorg.cometd.bayeux.server.ServerSession
-
setMaxInterval
public void setMaxInterval(long maxInterval) - Specified by:
setMaxIntervalin interfaceorg.cometd.bayeux.server.ServerSession
-
getIntervalNanoTime
public long getIntervalNanoTime()- Returns:
- the nanoTime at which this session is expired
-
getAttribute
-
getAttributeNames
-
removeAttribute
-
setAttribute
-
isHandshook
public boolean isHandshook()- Specified by:
isHandshookin interfaceorg.cometd.bayeux.Session
-
isConnected
public boolean isConnected()- Specified by:
isConnectedin interfaceorg.cometd.bayeux.Session
-
isDisconnected
public boolean isDisconnected() -
isTerminated
public boolean isTerminated() -
extendIncoming
protected void extendIncoming(org.cometd.bayeux.server.ServerMessage.Mutable message, org.cometd.bayeux.Promise<Boolean> promise) -
reAdvise
public void reAdvise() -
takeAdvice
-
getServerTransport
public org.cometd.bayeux.server.ServerTransport getServerTransport()- Specified by:
getServerTransportin interfaceorg.cometd.bayeux.server.ServerSession
-
setServerTransport
public void setServerTransport(org.cometd.bayeux.server.ServerTransport transport) -
updateServerEndPoint
-
getTimeout
public long getTimeout()- Specified by:
getTimeoutin interfaceorg.cometd.bayeux.server.ServerSession
-
getInterval
public long getInterval()- Specified by:
getIntervalin interfaceorg.cometd.bayeux.server.ServerSession
-
setTimeout
public void setTimeout(long timeoutMS) - Specified by:
setTimeoutin interfaceorg.cometd.bayeux.server.ServerSession
-
setInterval
public void setInterval(long intervalMS) - Specified by:
setIntervalin interfaceorg.cometd.bayeux.server.ServerSession
-
isBroadcastToPublisher
public boolean isBroadcastToPublisher()- Specified by:
isBroadcastToPublisherin interfaceorg.cometd.bayeux.server.ServerSession
-
setBroadcastToPublisher
public void setBroadcastToPublisher(boolean value) - Specified by:
setBroadcastToPublisherin interfaceorg.cometd.bayeux.server.ServerSession
-
removed
protected boolean removed(org.cometd.bayeux.server.ServerMessage message, boolean timeout) - 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:
setMetaConnectDeliveryOnlyin interfaceorg.cometd.bayeux.server.ServerSession
-
isMetaConnectDeliveryOnly
public boolean isMetaConnectDeliveryOnly()- Specified by:
isMetaConnectDeliveryOnlyin interfaceorg.cometd.bayeux.server.ServerSession
-
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
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:
-
dump
- Specified by:
dumpin interfaceorg.eclipse.jetty.util.component.Dumpable- Throws:
IOException
-
toString
-