public final class Acceptor extends Object
Modifier and Type | Class and Description |
---|---|
static interface |
Acceptor.Listener
Listener interface.
|
static class |
Acceptor.ShutdownException
Indicates the Acceptor has been shut down.
|
Constructor and Description |
---|
Acceptor(String addressString,
int port,
int numberOfThreads,
TimeAuthority timeAuthority)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
addListener(ConnectionType connectionType,
Acceptor.Listener listener)
Add a new listener.
|
int |
getNumberOfConnections()
The number of connections that have been accepted and are still active.
|
Exception |
getPendingException()
Asynchronous exception handling.
|
int |
getPort()
Get the port this Acceptor is listening on.
|
void |
shutdown()
Shut down this acceptor.
|
public Acceptor(String addressString, int port, int numberOfThreads, TimeAuthority timeAuthority) throws CommunicationException
addressString
- The TCP address to listen on. Zero-length
string => listen on all interfaces.port
- The TCP port to listen to. 0 => use any free port.numberOfThreads
- Number of acceptor threads.timeAuthority
- Knows the time.CommunicationException
- If server socket could not be
bound.public void shutdown() throws CommunicationException
CommunicationException
- If an IO exception occurs.public int getPort()
public Exception getPendingException()
null
if this Acceptor has been shut down.public int getNumberOfConnections()
public void addListener(ConnectionType connectionType, Acceptor.Listener listener)
connectionType
- The connection type.listener
- The listener.Copyright © 2000-2014. All Rights Reserved.