Class Endpoint
- java.lang.Object
 - 
- de.gebit.integrity.remoting.transport.Endpoint
 
 
- 
public class Endpoint extends Object
An endpoint is a client- or serverside termination point of a message channel. The endpoint uses a TCP connection to transmit messages bidirectionally, with processors waiting for new messages to arrive.- Author:
 - Rene Schneider - initial API and implementation
 
 
- 
- 
Constructor Summary
Constructors Constructor Description Endpoint(String aHost, int aPort, Map<Class<? extends AbstractMessage>,MessageProcessor<?>> aProcessorMap, EndpointListener aListener, ClassLoader aClassLoader)Creates a new endpoint and connects to a remote host, on which aServerEndpointis expected to run.Endpoint(Socket aSocket, Map<Class<? extends AbstractMessage>,MessageProcessor<?>> aProcessorMap, EndpointListener aListener, ClassLoader aClassLoader)Creates a new endpoint from a specific, already-connected socket. 
- 
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose(boolean anEmptyOutputQueueFlag)Close the connection.protected com.esotericsoftware.kryo.KryoinstantiateKryo()Instantiates the Kryo serialization framework.booleanisActive()booleanisDisconnectRequested()voidsendMessage(AbstractMessage aMessage)Sends a message. 
 - 
 
- 
- 
Constructor Detail
- 
Endpoint
public Endpoint(Socket aSocket, Map<Class<? extends AbstractMessage>,MessageProcessor<?>> aProcessorMap, EndpointListener aListener, ClassLoader aClassLoader)
Creates a new endpoint from a specific, already-connected socket.- Parameters:
 aSocket- the connected socketaProcessorMap- the processorsaListener- the listeneraClassLoader- the classloader to use when deserializing objects
 
- 
Endpoint
public Endpoint(String aHost, int aPort, Map<Class<? extends AbstractMessage>,MessageProcessor<?>> aProcessorMap, EndpointListener aListener, ClassLoader aClassLoader) throws UnknownHostException, IOException
Creates a new endpoint and connects to a remote host, on which aServerEndpointis expected to run.- Parameters:
 aHost- the host name or IPaPort- the port to connect toaProcessorMap- the map of processorsaListener- the listeneraClassLoader- the classloader to use when deserializing objects- Throws:
 UnknownHostExceptionIOException
 
 - 
 
- 
Method Detail
- 
sendMessage
public void sendMessage(AbstractMessage aMessage)
Sends a message. This queues the message into the outqueue, which is then emptied asynchronously by theoutputProcessor.- Parameters:
 aMessage- the message to send
 
- 
isActive
public boolean isActive()
 
- 
isDisconnectRequested
public boolean isDisconnectRequested()
 
- 
close
public void close(boolean anEmptyOutputQueueFlag)
Close the connection.- Parameters:
 anEmptyOutputQueueFlag- whether the output queue shall be sent to the other endpoint before closing
 
- 
instantiateKryo
protected com.esotericsoftware.kryo.Kryo instantiateKryo()
Instantiates the Kryo serialization framework.- Returns:
 - an instantiated and fully configured 
Kryoinstance 
 
 - 
 
 -