Class ServerEndpoint
- java.lang.Object
-
- de.gebit.integrity.remoting.transport.ServerEndpoint
-
public class ServerEndpoint extends java.lang.Object
A server endpoint. This endpoint listens on a specified port and host IP for incoming connections from client endpoints. When a connection is established, it spawns a newEndpoint
for that specific connection and continues listening for more connections.- Author:
- Rene Schneider - initial API and implementation
-
-
Constructor Summary
Constructors Constructor Description ServerEndpoint(java.lang.String aHostIP, int aPort, java.util.Map<java.lang.Class<? extends AbstractMessage>,MessageProcessor<?>> aProcessorMap, java.lang.ClassLoader aClassLoader, boolean anIsForkFlag)
Creates a new server endpoint that listens on a specified port/IP.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
broadcastMessage(AbstractMessage aMessage)
Broadcasts a message to all active endpoints.void
closeAll(boolean anEmptyOutputQueueFlag)
Closes the server endpoint and all endpoints currently active.int
getPort()
Returns the port number on which the server endpoint is listening.boolean
isActive()
-
-
-
Constructor Detail
-
ServerEndpoint
public ServerEndpoint(java.lang.String aHostIP, int aPort, java.util.Map<java.lang.Class<? extends AbstractMessage>,MessageProcessor<?>> aProcessorMap, java.lang.ClassLoader aClassLoader, boolean anIsForkFlag) throws java.net.UnknownHostException, java.io.IOException
Creates a new server endpoint that listens on a specified port/IP.- Parameters:
aHostIP
- the host IP to listen onaPort
- the port to bind to (0 = auto-choose a free port)aProcessorMap
- the map of processors to use for processing incoming messagesaClassLoader
- the classloader to use when deserializing objectsanIsForkFlag
- whether this server endpoint is serving inside an Integrity fork process- Throws:
java.net.UnknownHostException
java.io.IOException
-
-
Method Detail
-
isActive
public boolean isActive()
-
getPort
public int getPort()
Returns the port number on which the server endpoint is listening.- Returns:
-
closeAll
public void closeAll(boolean anEmptyOutputQueueFlag)
Closes the server endpoint and all endpoints currently active.- Parameters:
anEmptyOutputQueueFlag
- whether output queues to the endpoints shall be emptied before closing the connection.
-
broadcastMessage
public void broadcastMessage(AbstractMessage aMessage)
Broadcasts a message to all active endpoints.- Parameters:
aMessage
- the message
-
-