|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.faunos.util.net.HandletServer
public abstract class HandletServer
A Handlet
container implementing the server-side of a
network protocol.
Field Summary | |
---|---|
protected Logger |
logger
|
Constructor Summary | |
---|---|
|
HandletServer(InetAddress host,
int port,
ExecutorService exec)
Constructs a new instance with the given local host address and port number. |
protected |
HandletServer(InetAddress host,
int port,
ExecutorService exec,
Logger logger)
Constructs a new instance with the given local host address and port number. |
Method Summary | |
---|---|
protected ScatteringByteChannel |
inputChannel(SocketChannel socket)
Returns a ScatteringByteChannel facade for the given socket. |
boolean |
isAlive()
Determines whether the server is still running. |
protected abstract Handlet |
newHandlet()
Returns a protocol-specific handlet. |
protected GatheringByteChannel |
outputChannel(SocketChannel socket)
Returns a GatheringByteChannel facade for the given socket. |
void |
setProcessingHintThreshold(int threshold)
Sets the threshold at which this container's HandletContext hints handlets that they should try processing non-network I/O based tasks asynchronously. |
void |
start()
Starts the server. |
void |
stop()
Stops the server. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected final Logger logger
Constructor Detail |
---|
public HandletServer(InetAddress host, int port, ExecutorService exec) throws IOException
Handlet
s through the HandletContext.executor()
implementation provided by this class.
On return, the instance is listening on the specified port.
To begin servicing requests, invoke start().
The logger's hierarchical name is set to the class name of this base
implementation.
IOException
protected HandletServer(InetAddress host, int port, ExecutorService exec, Logger logger) throws IOException
Handlet
s through the HandletContext.executor()
implementation provided by this class.
On return, the instance is listening on the specified port.
To begin servicing requests, invoke start().
logger
- the logger used by the server. If null, then a logger
using the class name of the implementation subclass is used.
IOException
Method Detail |
---|
public void setProcessingHintThreshold(int threshold)
public void start()
public final boolean isAlive()
public void stop()
protected abstract Handlet newHandlet()
protected ScatteringByteChannel inputChannel(SocketChannel socket)
protected GatheringByteChannel outputChannel(SocketChannel socket)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |