Package com.illumon.util.net
Class AbstractCommServer
java.lang.Object
com.illumon.util.net.AbstractCommServer
- All Implemented Interfaces:
com.fishlib.base.log.LogOutputAppendable,CommServer
- Direct Known Subclasses:
WebSocketCommProxy,WSCommServer
Abstract base class for CommServer impls, like fishlib and websocket. Members copied from fishlib's Server verbatim.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final com.fishlib.io.logger.Loggerthe loggerprotected final Stringthe name of this serverFields inherited from interface io.deephaven.enterprise.comm.api.CommServer
IGNORE_CACHE_CLIENTS, ONLY_CACHE_CLIENTS, SEND_TO_ALL -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidadd a client to the listvoidaddCommandHandler(String id, CommandHandler commandHandler) Add a new command handler to this server.voidprotected ClientEntry[]return an array of all clientsReturn the set of connected clientsprotected CommandHandlergetHandler(String serviceId) return the handler for a service IDgetName()protected CommandHandlerputHandler(String serviceId, CommandHandler handler) return the handler for a service IDprotected voidremove a client to the listvoidRemove a command handler from this server.booleansendCommand(ClientEntry client, String serviceId, com.fishlib.base.Command cmd, boolean allowFlush) Send a command to a specific client.voidsendCommand(String serviceId, com.fishlib.base.Command cmd) Send a command to all clients for a specified service.voidsendCommand(String serviceId, com.fishlib.base.Command cmd, int sendTo) Send a command to all clients for a specified service which also match the sendTo flagvoiddisconnect all clients, but leave the server socket openMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.deephaven.enterprise.comm.api.CommServer
getPort, handleCommand, sendAsyncCommandWithResponse, sendCommand, sendCommandWithResponse, sendCommandWithResponse, sendCommandWithResponseMethods inherited from interface com.fishlib.base.log.LogOutputAppendable
append
-
Field Details
-
name
the name of this server -
log
protected final com.fishlib.io.logger.Logger logthe logger
-
-
Constructor Details
-
AbstractCommServer
-
-
Method Details
-
putHandler
return the handler for a service ID -
getHandler
return the handler for a service ID -
addClientEntry
add a client to the list- Specified by:
addClientEntryin interfaceCommServer
-
removeClientEntry
remove a client to the list -
getClients
return an array of all clients -
getName
-
sendCommand
Send a command to all clients for a specified service.- Specified by:
sendCommandin interfaceCommServer
-
sendCommand
Send a command to all clients for a specified service which also match the sendTo flag- Specified by:
sendCommandin interfaceCommServer
-
sendCommand
public boolean sendCommand(ClientEntry client, String serviceId, com.fishlib.base.Command cmd, boolean allowFlush) Send a command to a specific client. The serviceId is not checked before sending the message, but it is passed along to the client's processCommand() method.- Specified by:
sendCommandin interfaceCommServer
-
getClientSet
Return the set of connected clients- Specified by:
getClientSetin interfaceCommServer
-
addCommandHandler
Add a new command handler to this server.- Specified by:
addCommandHandlerin interfaceCommServer
-
removeCommandHandler
Remove a command handler from this server.- Specified by:
removeCommandHandlerin interfaceCommServer
-
disconnect
- Specified by:
disconnectin interfaceCommServer- Throws:
IOException
-
TEST_SOCKET_CLOSE
public void TEST_SOCKET_CLOSE()disconnect all clients, but leave the server socket open- Specified by:
TEST_SOCKET_CLOSEin interfaceCommServer
-