Class SessionTracker

  • All Implemented Interfaces:
    org.eclipse.jetty.util.component.Dumpable, org.eclipse.jetty.util.component.Graceful, org.eclipse.jetty.util.component.LifeCycle, org.eclipse.jetty.websocket.api.WebSocketSessionListener

    public class SessionTracker
    extends org.eclipse.jetty.util.component.AbstractLifeCycle
    implements org.eclipse.jetty.websocket.api.WebSocketSessionListener, org.eclipse.jetty.util.component.Graceful, org.eclipse.jetty.util.component.Dumpable
    • Nested Class Summary

      • Nested classes/interfaces inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle

        org.eclipse.jetty.util.component.AbstractLifeCycle.AbstractLifeCycleListener, org.eclipse.jetty.util.component.AbstractLifeCycle.StopException
      • 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.eclipse.jetty.util.component.Graceful

        org.eclipse.jetty.util.component.Graceful.Shutdown, org.eclipse.jetty.util.component.Graceful.ThrowingRunnable
      • Nested classes/interfaces inherited from interface org.eclipse.jetty.util.component.LifeCycle

        org.eclipse.jetty.util.component.LifeCycle.Listener
    • Field Summary

      • Fields inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle

        FAILED, STARTED, STARTING, STOPPED, STOPPING
      • Fields inherited from interface org.eclipse.jetty.util.component.Dumpable

        KEY
    • Constructor Summary

      Constructors 
      Constructor Description
      SessionTracker()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected void doStart()  
      protected void doStop()  
      void dump​(java.lang.Appendable out, java.lang.String indent)  
      int getNumSessions()  
      java.util.Collection<org.eclipse.jetty.websocket.api.Session> getSessions()  
      boolean isShutdown()  
      void onWebSocketSessionClosed​(org.eclipse.jetty.websocket.api.Session session)  
      void onWebSocketSessionOpened​(org.eclipse.jetty.websocket.api.Session session)  
      java.util.concurrent.CompletableFuture<java.lang.Void> shutdown()  
      • Methods inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle

        addEventListener, getEventListeners, getState, getState, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeEventListener, setEventListeners, start, stop, toString
      • 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
      • Methods inherited from interface org.eclipse.jetty.websocket.api.WebSocketSessionListener

        onWebSocketSessionCreated
    • Constructor Detail

      • SessionTracker

        public SessionTracker()
    • Method Detail

      • getSessions

        public java.util.Collection<org.eclipse.jetty.websocket.api.Session> getSessions()
      • onWebSocketSessionOpened

        public void onWebSocketSessionOpened​(org.eclipse.jetty.websocket.api.Session session)
        Specified by:
        onWebSocketSessionOpened in interface org.eclipse.jetty.websocket.api.WebSocketSessionListener
      • onWebSocketSessionClosed

        public void onWebSocketSessionClosed​(org.eclipse.jetty.websocket.api.Session session)
        Specified by:
        onWebSocketSessionClosed in interface org.eclipse.jetty.websocket.api.WebSocketSessionListener
      • doStart

        protected void doStart()
                        throws java.lang.Exception
        Overrides:
        doStart in class org.eclipse.jetty.util.component.AbstractLifeCycle
        Throws:
        java.lang.Exception
      • doStop

        protected void doStop()
                       throws java.lang.Exception
        Overrides:
        doStop in class org.eclipse.jetty.util.component.AbstractLifeCycle
        Throws:
        java.lang.Exception
      • shutdown

        public java.util.concurrent.CompletableFuture<java.lang.Void> shutdown()
        Specified by:
        shutdown in interface org.eclipse.jetty.util.component.Graceful
      • isShutdown

        public boolean isShutdown()
        Specified by:
        isShutdown in interface org.eclipse.jetty.util.component.Graceful
      • getNumSessions

        @ManagedAttribute("Total number of active WebSocket Sessions")
        public int getNumSessions()
      • 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