Class SessionTracker
- java.lang.Object
-
- org.eclipse.jetty.util.component.AbstractLifeCycle
-
- org.eclipse.jetty.websocket.common.SessionTracker
-
- All Implemented Interfaces:
Dumpable
,Graceful
,LifeCycle
,WebSocketSessionListener
public class SessionTracker extends AbstractLifeCycle implements WebSocketSessionListener, Graceful, Dumpable
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle
AbstractLifeCycle.AbstractLifeCycleListener, AbstractLifeCycle.StopException
-
Nested classes/interfaces inherited from interface org.eclipse.jetty.util.component.Dumpable
Dumpable.DumpableContainer
-
Nested classes/interfaces inherited from interface org.eclipse.jetty.util.component.Graceful
Graceful.Shutdown, Graceful.ThrowingRunnable
-
Nested classes/interfaces inherited from interface org.eclipse.jetty.util.component.LifeCycle
LifeCycle.Listener
-
-
Constructor Summary
Constructors Constructor Description SessionTracker()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
doStart()
Method to override to start the lifecycleprotected void
doStop()
Method to override to stop the lifecyclevoid
dump(java.lang.Appendable out, java.lang.String indent)
Dump this object (and children) into an Appendable using the provided indent after any new lines.int
getNumSessions()
java.util.Collection<Session>
getSessions()
boolean
isShutdown()
void
onWebSocketSessionClosed(Session session)
void
onWebSocketSessionOpened(Session session)
java.util.concurrent.CompletableFuture<java.lang.Void>
shutdown()
Shutdown the component.-
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.websocket.api.WebSocketSessionListener
onWebSocketSessionCreated
-
-
-
-
Method Detail
-
getSessions
public java.util.Collection<Session> getSessions()
-
onWebSocketSessionOpened
public void onWebSocketSessionOpened(Session session)
- Specified by:
onWebSocketSessionOpened
in interfaceWebSocketSessionListener
-
onWebSocketSessionClosed
public void onWebSocketSessionClosed(Session session)
- Specified by:
onWebSocketSessionClosed
in interfaceWebSocketSessionListener
-
doStart
protected void doStart() throws java.lang.Exception
Description copied from class:AbstractLifeCycle
Method to override to start the lifecycle- Overrides:
doStart
in classAbstractLifeCycle
- Throws:
AbstractLifeCycle.StopException
- If thrown, the lifecycle will immediately be stopped.java.lang.Exception
- If there was a problem starting. Will cause a transition to FAILED state
-
doStop
protected void doStop() throws java.lang.Exception
Description copied from class:AbstractLifeCycle
Method to override to stop the lifecycle- Overrides:
doStop
in classAbstractLifeCycle
- Throws:
java.lang.Exception
- If there was a problem stopping. Will cause a transition to FAILED state
-
shutdown
public java.util.concurrent.CompletableFuture<java.lang.Void> shutdown()
Description copied from interface:Graceful
Shutdown the component. When this method returns, the component should not accept any new load.
-
isShutdown
public boolean isShutdown()
- Specified by:
isShutdown
in interfaceGraceful
- Returns:
- True if
Graceful.shutdown()
has been called.
-
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
Description copied from interface:Dumpable
Dump this object (and children) into an Appendable using the provided indent after any new lines. The indent should not be applied to the first object dumped.
-
-