Class GlobeWebSocket
- All Implemented Interfaces:
org.eclipse.jetty.ee8.websocket.api.WebSocketConnectionListener, org.eclipse.jetty.ee8.websocket.api.WebSocketListener
The Monitor plugin (where this class runs) is a separate JVM/process from the MasterServer, connected only over RMI
(see MasterManager), so it cannot read the MasterServer-side LiveTransferRegistry
singleton directly - a shared, JVM-wide poller (started lazily on the first connection, stopped once the last one
closes) periodically calls ManagementInterface.getLiveTransfers() and
ManagementInterface.getLiveTransferOrigin() over RMI and fans the resulting snapshot out
to every currently connected client as a "snapshot" message (which the frontend uses to fully replace its current
transfer set, so no client-side diffing is needed). Polling only happens while at least one globe page is open, which
is also what keeps DataMovers sampling (see LiveTransferRegistry.touch()). Geolocation of
Host/Mover names is likewise always resolved on the MasterServer side, via
ManagementInterface.getGeoLocations(String[]) - the Monitor JVM never needs its own copy
of the GeoIP2 database.
Implements the (legacy/"ee8") WebSocketListener interface directly rather than relying on the
annotation-based API, since the endpoint is registered through
JettyWebSocketServletContainerInitializer, whose frame-handler
factory only recognises org.eclipse.jetty.ee8.websocket.api.annotations.* annotations (not the similarly
named ones in org.eclipse.jetty.websocket.api.annotations), so implementing the interface avoids that
ambiguity.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidonWebSocketClose(int statusCode, String reason) Called when the WebSocket is closed.voidonWebSocketConnect(org.eclipse.jetty.ee8.websocket.api.Session session) Called when the WebSocket is connected.voidonWebSocketError(Throwable error) Called on WebSocket error.voidonWebSocketText(String message) Called when a message is received from the client.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.eclipse.jetty.ee8.websocket.api.WebSocketListener
onWebSocketBinary
-
Constructor Details
-
GlobeWebSocket
public GlobeWebSocket()
-
-
Method Details
-
onWebSocketConnect
public void onWebSocketConnect(org.eclipse.jetty.ee8.websocket.api.Session session) Called when the WebSocket is connected. Registers this connection for broadcast, starts the shared poller if it is not already running, and sends an initial "hello" (origin location) and "snapshot" (currently active transfers) message.- Specified by:
onWebSocketConnectin interfaceorg.eclipse.jetty.ee8.websocket.api.WebSocketConnectionListener- Parameters:
session- the connected WebSocket session
-
onWebSocketText
Called when a message is received from the client. No client-initiated commands are currently supported; this is a read-only stream, so any incoming message is simply ignored.- Specified by:
onWebSocketTextin interfaceorg.eclipse.jetty.ee8.websocket.api.WebSocketListener- Parameters:
message- the raw message from the client
-
onWebSocketClose
Called when the WebSocket is closed. Unregisters this connection from the broadcast set, and stops the shared poller if it was the last one.- Specified by:
onWebSocketClosein interfaceorg.eclipse.jetty.ee8.websocket.api.WebSocketConnectionListener- Parameters:
statusCode- the close status codereason- the reason for closure
-
onWebSocketError
Called on WebSocket error. Unregisters this connection from the broadcast set.- Specified by:
onWebSocketErrorin interfaceorg.eclipse.jetty.ee8.websocket.api.WebSocketConnectionListener- Parameters:
error- the thrown error
-