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 java.lang.Object
implements org.cometd.bayeux.server.ServerSession, org.eclipse.jetty.util.component.Dumpable
  • Constructor Details

  • Method Details

    • getBayeuxServer

      public BayeuxServerImpl getBayeuxServer()
    • getUserAgent

      public java.lang.String getUserAgent()
      Specified by:
      getUserAgent in interface org.cometd.bayeux.server.ServerSession
      Returns:
      the remote user agent
    • setUserAgent

      public void setUserAgent​(java.lang.String userAgent)
      Parameters:
      userAgent - the remote user agent
    • getBrowserId

      public java.lang.String getBrowserId()
      Returns:
      the remote client identifier
    • setBrowserId

      public void setBrowserId​(java.lang.String browserId)

      Sets a remote client identifier, typically a browser.

      Parameters:
      browserId - the remote client identifier
    • sweep

      protected void sweep​(long now)
    • getSubscriptions

      public java.util.Set<org.cometd.bayeux.server.ServerChannel> getSubscriptions()
      Specified by:
      getSubscriptions in interface org.cometd.bayeux.server.ServerSession
    • addExtension

      public void addExtension​(org.cometd.bayeux.server.ServerSession.Extension extension)
      Specified by:
      addExtension in interface org.cometd.bayeux.server.ServerSession
    • removeExtension

      public void removeExtension​(org.cometd.bayeux.server.ServerSession.Extension extension)
      Specified by:
      removeExtension in interface org.cometd.bayeux.server.ServerSession
    • getExtensions

      public java.util.List<org.cometd.bayeux.server.ServerSession.Extension> getExtensions()
      Specified by:
      getExtensions in interface org.cometd.bayeux.server.ServerSession
    • batch

      public void batch​(java.lang.Runnable batch)
      Specified by:
      batch in interface org.cometd.bayeux.Session
    • deliver

      public void deliver​(org.cometd.bayeux.Session sender, org.cometd.bayeux.server.ServerMessage.Mutable message)
      Specified by:
      deliver in interface org.cometd.bayeux.server.ServerSession
    • deliver

      public void deliver​(org.cometd.bayeux.Session sender, java.lang.String channelId, java.lang.Object data)
      Specified by:
      deliver in interface org.cometd.bayeux.server.ServerSession
    • doDeliver

      protected void doDeliver​(org.cometd.bayeux.server.ServerSession sender, org.cometd.bayeux.server.ServerMessage.Mutable mutable)
    • extendSend

      protected org.cometd.bayeux.server.ServerMessage.Mutable extendSend​(org.cometd.bayeux.server.ServerMessage.Mutable mutable)
    • handshake

      protected void handshake()
    • connected

      protected void connected()
    • disconnect

      public void disconnect()
      Specified by:
      disconnect in interface org.cometd.bayeux.Session
    • startBatch

      public void startBatch()
      Specified by:
      startBatch in interface org.cometd.bayeux.Session
    • endBatch

      public boolean endBatch()
      Specified by:
      endBatch in interface org.cometd.bayeux.Session
    • getLocalSession

      public org.cometd.bayeux.server.LocalSession getLocalSession()
      Specified by:
      getLocalSession in interface org.cometd.bayeux.server.ServerSession
    • isLocalSession

      public boolean isLocalSession()
      Specified by:
      isLocalSession in interface org.cometd.bayeux.server.ServerSession
    • addListener

      public void addListener​(org.cometd.bayeux.server.ServerSession.ServerSessionListener listener)
      Specified by:
      addListener in interface org.cometd.bayeux.server.ServerSession
    • getId

      public java.lang.String getId()
      Specified by:
      getId in interface org.cometd.bayeux.Session
    • getLock

      public java.lang.Object getLock()
    • getQueue

      public java.util.Queue<org.cometd.bayeux.server.ServerMessage> getQueue()
    • hasNonLazyMessages

      public boolean hasNonLazyMessages()
    • addMessage

      protected void addMessage​(org.cometd.bayeux.server.ServerMessage message)
    • takeQueue

      public java.util.List<org.cometd.bayeux.server.ServerMessage> takeQueue()
    • removeListener

      public void removeListener​(org.cometd.bayeux.server.ServerSession.ServerSessionListener listener)
      Specified by:
      removeListener in interface org.cometd.bayeux.server.ServerSession
    • getListeners

      public java.util.List<org.cometd.bayeux.server.ServerSession.ServerSessionListener> getListeners()
    • setScheduler

      public void setScheduler​(AbstractServerTransport.Scheduler newScheduler)
    • shouldSchedule

      public boolean shouldSchedule()
    • flush

      public void flush()
    • cancelSchedule

      public void cancelSchedule()
    • cancelExpiration

      public void cancelExpiration​(boolean metaConnect)
    • scheduleExpiration

      public void scheduleExpiration​(long defaultInterval)
    • getMaxInterval

      protected long getMaxInterval()
    • getAttribute

      public java.lang.Object getAttribute​(java.lang.String name)
      Specified by:
      getAttribute in interface org.cometd.bayeux.Session
    • getAttributeNames

      public java.util.Set<java.lang.String> getAttributeNames()
      Specified by:
      getAttributeNames in interface org.cometd.bayeux.Session
    • removeAttribute

      public java.lang.Object removeAttribute​(java.lang.String name)
      Specified by:
      removeAttribute in interface org.cometd.bayeux.Session
    • setAttribute

      public void setAttribute​(java.lang.String name, java.lang.Object value)
      Specified by:
      setAttribute in interface org.cometd.bayeux.Session
    • isHandshook

      public boolean isHandshook()
      Specified by:
      isHandshook in interface org.cometd.bayeux.Session
    • isConnected

      public boolean isConnected()
      Specified by:
      isConnected in interface org.cometd.bayeux.Session
    • isDisconnected

      public boolean isDisconnected()
    • extendRecv

      protected boolean extendRecv​(org.cometd.bayeux.server.ServerMessage.Mutable message)
    • reAdvise

      public void reAdvise()
    • takeAdvice

      public java.util.Map<java.lang.String,​java.lang.Object> takeAdvice​(org.cometd.bayeux.server.ServerTransport transport)
    • getTimeout

      public long getTimeout()
      Specified by:
      getTimeout in interface org.cometd.bayeux.server.ServerSession
    • getInterval

      public long getInterval()
      Specified by:
      getInterval in interface org.cometd.bayeux.server.ServerSession
    • setTimeout

      public void setTimeout​(long timeoutMS)
      Specified by:
      setTimeout in interface org.cometd.bayeux.server.ServerSession
    • setInterval

      public void setInterval​(long intervalMS)
      Specified by:
      setInterval in interface org.cometd.bayeux.server.ServerSession
    • isBroadcastToPublisher

      public boolean isBroadcastToPublisher()
    • setBroadcastToPublisher

      public void setBroadcastToPublisher​(boolean value)
    • 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)
    • subscribedTo

      protected void subscribedTo​(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 java.lang.String dump()
      Specified by:
      dump in interface org.eclipse.jetty.util.component.Dumpable
    • dump

      public void dump​(java.lang.Appendable out, java.lang.String indent) throws java.io.IOException
      Specified by:
      dump in interface org.eclipse.jetty.util.component.Dumpable
      Throws:
      java.io.IOException
    • toString

      public java.lang.String toString()
      Overrides:
      toString in class java.lang.Object