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.DumpableContainerNested 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 TypeMethodDescriptionvoidaddExtension(ServerSession.Extension extension) voidprotected voidaddMessage(ServerMessage message) voidlongcalculateInterval(long defaultInterval) longcalculateTimeout(long defaultTimeout) voidcancelExpiration(boolean metaConnect) protected booleanvoiddeliver(org.cometd.bayeux.Session sender, String channelId, Object data, org.cometd.bayeux.Promise<Boolean> promise) voiddeliver(org.cometd.bayeux.Session sender, ServerMessage.Mutable message, org.cometd.bayeux.Promise<Boolean> promise) protected voiddeliver1(ServerSession sender, ServerMessage.Mutable mutable, org.cometd.bayeux.Promise<Boolean> promise) voidvoidvoiddump(Appendable out, String indent) booleanendBatch()protected voidextendIncoming(ServerMessage.Mutable message, org.cometd.bayeux.Promise<Boolean> promise) protected voidextendOutgoing(ServerSession sender, ServerMessage.Mutable message, org.cometd.bayeux.Promise<ServerMessage.Mutable> promise) voidflush()getAttribute(String name) getId()longgetLock()longgetQueue()longprotected booleanhandshake(ServerMessage.Mutable message) booleanbooleanbooleanbooleanbooleanbooleanbooleanbooleanbooleanvoidnotifyResumed(ServerMessage message, boolean timeout) voidnotifySuspended(ServerMessage message, long timeout) voidreAdvise()removeAttribute(String name) protected booleanremoved(ServerMessage message, boolean timeout) voidremoveExtension(ServerSession.Extension extension) voidvoidscheduleExpiration(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(ServerTransport transport) voidsetTimeout(long timeoutMS) voidsetUserAgent(String userAgent) booleanvoidprotected booleansubscribe(ServerChannelImpl channel) protected voidsweep(long now) takeAdvice(ServerTransport transport) takeQueue(List<ServerMessage.Mutable> replies) 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 java.lang.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 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:
getSubscriptionsin interfaceServerSession
-
addExtension
- Specified by:
addExtensionin interfaceServerSession
-
removeExtension
- Specified by:
removeExtensionin interfaceServerSession
-
getExtensions
- Specified by:
getExtensionsin interfaceServerSession
-
batch
- Specified by:
batchin interfaceorg.cometd.bayeux.Session
-
deliver
public void deliver(org.cometd.bayeux.Session sender, ServerMessage.Mutable message, org.cometd.bayeux.Promise<Boolean> promise) - Specified by:
deliverin interfaceServerSession
-
deliver
public void deliver(org.cometd.bayeux.Session sender, String channelId, Object data, org.cometd.bayeux.Promise<Boolean> promise) - Specified by:
deliverin 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:
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
- Specified by:
getLocalSessionin interfaceServerSession
-
isLocalSession
public boolean isLocalSession()- Specified by:
isLocalSessionin interfaceServerSession
-
addListener
- Specified by:
addListenerin interfaceServerSession
-
getId
- Specified by:
getIdin interfaceorg.cometd.bayeux.Session
-
getLock
-
getQueue
-
hasNonLazyMessages
public boolean hasNonLazyMessages() -
addMessage
-
takeQueue
-
notifySuspended
-
notifyResumed
-
removeListener
- Specified by:
removeListenerin 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:
getMaxIntervalin interfaceServerSession
-
setMaxInterval
public void setMaxInterval(long maxInterval) - Specified by:
setMaxIntervalin interfaceServerSession
-
getAttribute
- Specified by:
getAttributein interfaceorg.cometd.bayeux.Session
-
getAttributeNames
- Specified by:
getAttributeNamesin interfaceorg.cometd.bayeux.Session
-
removeAttribute
- Specified by:
removeAttributein interfaceorg.cometd.bayeux.Session
-
setAttribute
- Specified by:
setAttributein interfaceorg.cometd.bayeux.Session
-
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(ServerMessage.Mutable message, org.cometd.bayeux.Promise<Boolean> promise) -
reAdvise
public void reAdvise() -
takeAdvice
-
getServerTransport
- Specified by:
getServerTransportin interfaceServerSession
-
setServerTransport
-
updateServerEndPoint
-
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()- Specified by:
isBroadcastToPublisherin interfaceServerSession
-
setBroadcastToPublisher
public void setBroadcastToPublisher(boolean value) - Specified by:
setBroadcastToPublisherin 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:
setMetaConnectDeliveryOnlyin interfaceServerSession
-
isMetaConnectDeliveryOnly
public boolean isMetaConnectDeliveryOnly()- Specified by:
isMetaConnectDeliveryOnlyin 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
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
-