public class Server extends Thread implements Closeable
Thread.State, Thread.UncaughtExceptionHandler
Modifier and Type | Field and Description |
---|---|
protected static org.slf4j.Logger |
log
The instance used for logging.
|
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
Constructor and Description |
---|
Server()
Alternate constructor.
|
Server(InetAddress address,
int port)
Default constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Shuts down this thread.
|
void |
closeIdleClients()
Closes all idle clients.
|
ServerProcessor.FlowProxy |
createFlow(FlowBuilder builder,
ClassLoader cl)
A facade for
createFlow(FlowBuilder, ClassLoader, int) . |
ServerProcessor.FlowProxy |
createFlow(FlowBuilder builder,
ClassLoader cl,
int flowFlags)
Creates a
Flow . |
<F,N> BlockingQueue<FlowEvent<F,N>> |
createFlowEventQueue()
|
static org.slf4j.Logger |
getLog()
Gets the static
Logger instance. |
int |
getPendingCount()
Gets the number of additional clients required to saturate all pending computations.
|
List<ServerProcessor.FlowProxy> |
refresh()
Refreshes all
Flow s. |
void |
run()
Runs the connection creation loop.
|
Server |
setAutocloseIdle(boolean autocloseIdle)
Sets whether idle clients should be automatically closed.
|
String |
toString()
Delegates to the underlying
ServerProcessor . |
activeCount, checkAccess, clone, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, yield
public Server(InetAddress address, int port) throws UnknownHostException, IOException
address
- the server's InetAddress
as it would appear to clients.port
- the port to listen on.UnknownHostException
- when the server's InetAddress
could not be inferred.IOException
- when the underlying ServerSocketChannel
could not be bound.public Server() throws UnknownHostException, IOException
Constants.DEFAULT_SERVER_PORT
.UnknownHostException
- when the server's InetAddress
could not be inferred.IOException
- when the underlying ServerSocketChannel
could not be bound.public static final org.slf4j.Logger getLog()
Logger
instance.public ServerProcessor.FlowProxy createFlow(FlowBuilder builder, ClassLoader cl) throws InterruptedException, ExecutionException
createFlow(FlowBuilder, ClassLoader, int)
.InterruptedException
- when this operation is interrupted.ExecutionException
- when something goes awry.public ServerProcessor.FlowProxy createFlow(FlowBuilder builder, ClassLoader cl, int flowFlags) throws InterruptedException, ExecutionException
Flow
.InterruptedException
- when this operation is interrupted.ExecutionException
- when something goes awry.public List<ServerProcessor.FlowProxy> refresh() throws InterruptedException, ExecutionException
Flow
s.InterruptedException
- when this operation is interrupted.ExecutionException
- when something goes awry.public void closeIdleClients() throws InterruptedException, ExecutionException
InterruptedException
- when this operation is interrupted.ExecutionException
- when something goes awry.public Server setAutocloseIdle(boolean autocloseIdle) throws InterruptedException, ExecutionException
InterruptedException
- when this operation is interrupted.ExecutionException
- when something goes awry.public int getPendingCount() throws InterruptedException, ExecutionException
InterruptedException
- when this operation is interrupted.ExecutionException
- when something goes awry.public <F,N> BlockingQueue<FlowEvent<F,N>> createFlowEventQueue() throws InterruptedException, ExecutionException
F
- the Flow
attachment type.N
- the FlowNode
attachment type.InterruptedException
- when this operation is interrupted.ExecutionException
- when something goes awry.public String toString()
ServerProcessor
.public void close()
close
in interface Closeable
close
in interface AutoCloseable