Package com.kristensoft.kdc
Class WebSocketServer
- java.lang.Object
-
- com.kristensoft.kdc.Server
-
- com.kristensoft.kdc.WebSocketServer
-
- All Implemented Interfaces:
Closeable,AutoCloseable,Runnable
public class WebSocketServer extends Server
Provides a KDC server that receives agents using the WebSocket protocol.The server uses Jetty to accept WebSocket connections at the configured endpoint path. Each accepted connection is associated with a
WebSocketEndpoint, which deserializes received messages and queues KDC agents for processing.- Author:
- Charles B. Kozoyed
- See Also:
Server,WebSocketServerParameters,WebSocketEndpoint
-
-
Constructor Summary
Constructors Constructor Description WebSocketServer(WebSocketServerParameters wssParameters)Creates a WebSocket server using the specified parameters.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Stops the underlying Jetty WebSocket server.voidflushMetrics()Flushes the accumulated latency metrics for this communication entity.AgentSerializergetAgentSerializer()Returns the agent serializer used by this communication entity.booleanisRunning()Determines whether this communication entity is currently running.voidrun()Starts the Jetty WebSocket server and waits for it to terminate.
-
-
-
Constructor Detail
-
WebSocketServer
public WebSocketServer(WebSocketServerParameters wssParameters) throws com.kristensoft.kdc.license.runtime.LicenseException
Creates a WebSocket server using the specified parameters.- Parameters:
wssParameters- the WebSocket server configuration parameters- Throws:
com.kristensoft.kdc.license.runtime.LicenseException- if the server cannot be created because of a licensing error
-
-
Method Detail
-
run
public void run()
Starts the Jetty WebSocket server and waits for it to terminate.After the Jetty server is started, the current thread waits until the server has stopped.
-
close
public void close()
Stops the underlying Jetty WebSocket server.If the Jetty server has not been created, this method has no effect. Errors encountered while stopping the server are logged.
-
isRunning
public boolean isRunning()
Determines whether this communication entity is currently running.- Returns:
trueif this communication entity is running;falseotherwise
-
flushMetrics
public void flushMetrics()
Flushes the accumulated latency metrics for this communication entity.This method may be used to report any currently accumulated metrics without waiting for the configured latency reporting interval.
-
getAgentSerializer
public AgentSerializer getAgentSerializer()
Returns the agent serializer used by this communication entity.The serializer may be used to inspect or modify serialization settings at runtime, including compression and encryption settings.
- Returns:
- the agent serializer used by this communication entity
-
-