public abstract class NetServerHelper extends HttpServerHelper
| Parameter name | Value type | Default value | Description |
|---|---|---|---|
| minThreads | int | 1 | Minimum number of worker threads waiting to service calls, even if they are idle. Technically speaking, this is a core number of threads that are pre-started. |
| maxThreads | int | 10 | Maximum number of worker threads that can service calls. If this number is reached then additional calls are queued if the "maxQueued" value hasn't been reached. |
| maxQueued | int | 0 | Maximum number of calls that can be queued if there aren't any worker
thread available to service them. If the value is '0', then no queue is used
and calls are rejected if no worker thread is immediately available. If the
value is '-1', then an unbounded queue is used and calls are never
rejected. Note: make sure that this value is consistent with getMinThreads()
and the behavior of the ThreadPoolExecutor configured
internally. |
| maxThreadIdleTimeMs | int | 300 000 | Time for an idle thread to wait for an operation before being collected. |
| Constructor and Description |
|---|
NetServerHelper(Server server)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
protected ThreadPoolExecutor |
createThreadPool()
Creates the handler service.
|
protected InetSocketAddress |
getAddress()
Returns the socket address this server is listening to.
|
int |
getMaxQueued()
Returns the maximum number of calls that can be queued if there aren't any
worker thread available to service them.
|
int |
getMaxThreadIdleTimeMs()
Returns the time for an idle thread to wait for an operation before being
collected.
|
int |
getMaxThreads()
Returns the maximum threads that will service requests.
|
int |
getMinThreads()
Returns the minimum threads waiting to service requests.
|
boolean |
isConfidential()
Indicates if this service is acting in HTTP or HTTPS mode.
|
protected void |
setAddress(InetSocketAddress address)
Sets the socket address this server is listening to.
|
protected void |
setConfidential(boolean confidential)
Indicates if this service is acting in HTTP or HTTPS mode.
|
void |
start()
Start callback.
|
void |
stop()
Stop callback.
|
getAdapter, handle, setAdapterhandle, setEphemeralPort, setEphemeralPortgetConnectorService, getContext, getProtocols, updategetAttributes, getHelped, getHelpedParameters, getLogger, getMetadataService, setHelpedpublic NetServerHelper(Server server)
server - The server to help.protected ThreadPoolExecutor createThreadPool()
protected InetSocketAddress getAddress()
public int getMaxQueued()
getMinThreads()
and the behavior of the ThreadPoolExecutor configured internally.public int getMaxThreadIdleTimeMs()
public int getMaxThreads()
public int getMinThreads()
public boolean isConfidential()
protected void setAddress(InetSocketAddress address)
address - The socket address this server is listening to.protected void setConfidential(boolean confidential)
confidential - True if this service is acting in HTTP or HTTPS mode.public void start()
throws Exception
RestletHelperstart in class ConnectorHelper<Server>Exceptionpublic void stop()
throws Exception
RestletHelperstop in class ServerHelperExceptionCopyright © 2005–2025. All rights reserved.