public final class GenericTCPServer extends Object
| Modifier and Type | Class and Description |
|---|---|
static interface |
GenericTCPServer.ConnectionHandler
Handles incomming connections
|
class |
GenericTCPServer.ServerContext
Information passed to a server implementation to provide
execution context.
|
| Constructor and Description |
|---|
GenericTCPServer(GenericTCPServer.ConnectionHandler handler)
Creates a new server
|
| Modifier and Type | Method and Description |
|---|---|
void |
awaitShutdown(long timeout,
TimeUnit unit)
Waits for pending requests to finish.
|
void |
disableThreadPooling()
Disables thread pooling of workers.
|
GenericTCPServer.ConnectionHandler |
getConnectionHandler()
Returns the handler to use for processing connections
|
String |
getHost()
Returns the specific ip address/host to bind to
|
int |
getIdleTimeTimeout()
Gets the idle time, in seconds, for the worker thread pool.
|
int |
getMaxWorkers()
Returns the max worker threads to allow.
|
int |
getMinWorkers()
Returns the min worker threads to allow.
|
String |
getName()
Gets the name used for worker threads.
|
int |
getPort()
Returns the port to bind to.
|
Thread.State |
getStatus() |
boolean |
isListenerDaemon()
Indicates whether the listener thread is a daemon thread.
|
boolean |
isWorkerDaemon()
Indicates whether worker threads are daemon threads.
|
void |
setHost(String host)
Sets the specific ip address/host to bind to
|
void |
setIdleTimeTimeout(int idleTimeTimeout)
Sets the idle time, in seconds, for the worker thread
pool.
|
void |
setListenerDaemon(boolean daemon)
Sets whether the listener thread is marked as a daemon thread.
|
void |
setMaxWorkers(int maxWorkers)
Sets the max worker thread to allow.
|
void |
setMinWorkers(int minWorkers)
Sets the min worker thread to allow.
|
void |
setName(String name)
Sets the base name used for worker threads.
|
void |
setPort(int port)
Sets the port to bind to.
|
void |
setWorkerDaemon(boolean daemon)
Sets whether worker threads are marked as daemon threads.
|
InetSocketAddress |
start()
Starts the server.
|
void |
startShutdown()
Initiates shutdown by closing the listening socket.
|
public GenericTCPServer(GenericTCPServer.ConnectionHandler handler)
handler - the handler to handle requestspublic GenericTCPServer.ConnectionHandler getConnectionHandler()
public int getMaxWorkers()
public void setMaxWorkers(int maxWorkers)
maxWorkers - The max worker threads to allow.public int getMinWorkers()
public void setMinWorkers(int minWorkers)
minWorkers - The min worker threads to allow.public String getHost()
public void setHost(String host)
ipaddress - the specific ip/host address to bind topublic final InetSocketAddress start()
DRException - if errors occur during start uppublic final void startShutdown()
public final void awaitShutdown(long timeout,
TimeUnit unit)
throws InterruptedException
timeout - the length of the timeoutunit - the unit of the timeoutInterruptedException - if interrupted while waiting for shutdownpublic int getPort()
public void setPort(int port)
port - the port to which to bindpublic boolean isListenerDaemon()
true if the listener is a daemon thread,
false otherwise.public void setListenerDaemon(boolean daemon)
daemon - indicates whether the listener is a daemon or notThread.setDaemon(boolean)public boolean isWorkerDaemon()
true if workers are daemon threads,
false otherwise.public void setWorkerDaemon(boolean daemon)
daemon - indicates whether workers are daemons or notThread.setDaemon(boolean)public final Thread.State getStatus()
public void setName(String name)
name - the base name to usepublic String getName()
public void setIdleTimeTimeout(int idleTimeTimeout)
idleTimeTimeout - the number of seconds a thread
may be idlepublic int getIdleTimeTimeout()
public void disableThreadPooling()
Copyright © 2020 Actian Corporation. All rights reserved.