public class NioManager extends Object implements SocketManager<NioManager,NioConnection>
NioConnection
s via callbacks.ConnectionManager.InitializationType
Modifier and Type | Field and Description |
---|---|
protected static Object |
classLock
A global lock for the entire class.
|
protected static WeakReference<NioManager> |
defaultInstanceRef
A
WeakReference to the global instance. |
Constructor and Description |
---|
NioManager(String name)
Default constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Shuts down this manager and reclaims its resources.
|
int |
getBacklogSize()
Gets the listen backlog size.
|
List<InetSocketAddress> |
getBoundAddresses()
Gets the list of bound addresses.
|
int |
getBufferSize()
Gets the read/write buffer size.
|
List<NioConnection> |
getConnections()
Gets the list of
Connection s. |
static NioManager |
getInstance()
Gets the global instance.
|
<T> Future<NioConnection> |
init(ConnectionManager.InitializationType type,
ConnectionHandler<? super NioConnection> handler,
T argument)
Initializes a
Connection . |
NioManager |
setBacklogSize(int backlogSize)
Sets the listen backlog size.
|
NioManager |
setBufferSize(int bufferSize)
Sets the read/write buffer size.
|
String |
toString()
Creates a human-readable representation of this manager.
|
protected static WeakReference<NioManager> defaultInstanceRef
WeakReference
to the global instance.protected static final Object classLock
public NioManager(String name)
name
- the name.public static final NioManager getInstance()
public <T> Future<NioConnection> init(ConnectionManager.InitializationType type, ConnectionHandler<? super NioConnection> handler, T argument)
ConnectionManager
Connection
.init
in interface ConnectionManager<NioConnection>
T
- the argument type.type
- the ConnectionManager.InitializationType
.handler
- the ConnectionHandler
.argument
- the argument.Future
for retrieving the newly initialized Connection
.ConnectionManager.InitializationType
public List<NioConnection> getConnections()
ConnectionManager
Connection
s.getConnections
in interface ConnectionManager<NioConnection>
public List<InetSocketAddress> getBoundAddresses()
SocketManager
getBoundAddresses
in interface SocketManager<NioManager,NioConnection>
public int getBacklogSize()
SocketManager
getBacklogSize
in interface SocketManager<NioManager,NioConnection>
public NioManager setBacklogSize(int backlogSize)
SocketManager
setBacklogSize
in interface SocketManager<NioManager,NioConnection>
backlogSize
- the backlog size.public int getBufferSize()
SocketManager
getBufferSize
in interface SocketManager<NioManager,NioConnection>
public NioManager setBufferSize(int bufferSize)
SocketManager
setBufferSize
in interface SocketManager<NioManager,NioConnection>
bufferSize
- the buffer size.public void close()
ConnectionManager
close
in interface Closeable
close
in interface AutoCloseable
close
in interface ConnectionManager<NioConnection>
public String toString()
ConnectionManager
toString
in interface ConnectionManager<NioConnection>
toString
in class Object