public final class ServerConfiguration
extends java.lang.Object
Server
configuration.Modifier and Type | Field and Description |
---|---|
static int |
DOMAIN_NAME_SYSTEM_53
The port for DNS with a port number of
53 . |
static int |
FILE_TRANSFER_PROTOCOL_20
The port for FTP with a port number of
20 . |
static int |
FILE_TRANSFER_PROTOCOL_21
The port for FTP with a port number of
21 . |
static int |
HYPERTEXT_TRANSFER_PROTOCOL_80
The port for HTTP with a port number of
80 . |
static int |
HYPERTEXT_TRANSFER_PROTOCOL_SECURE_443
The port for HTTPS with a port number of
443 . |
static int |
INTERNET_MESSAGE_ACCESS_PROTOCOL_143
The port for IMAP with a port number of
143 . |
static int |
NETWORK_NEWS_TRANSFER_PROTOCOL_119
The port for NNTP with a port number of
119 . |
static int |
PORT_NUMBER_MAXIMUM
The maximum port number allowed.
|
static int |
PORT_NUMBER_MINIMUM
The minimum port number allowed.
|
static int |
POST_OFFICE_PROTOCOL_110
The port for POP with a port number of
110 . |
static int |
SECURE_SHELL_22
The port for SSH with a port number of
22 . |
static int |
SIMPLE_MAIL_TRANSFER_PROTOCOL_25
The port for SMTP with a port number of
25 . |
static int |
SIMPLE_NETWORK_MANAGEMENT_PROTOCOL_161
The port for SNMP with a port number of
161 . |
static int |
TELNET_23
The port for TelNet with a port number of
23 . |
Modifier and Type | Method and Description |
---|---|
java.util.concurrent.Executor |
getExecutor()
Returns the
Executor that will process events. |
java.lang.String |
getHostname()
Returns the currently set hostname.
|
int |
getPort()
Returns the currently set port.
|
org.macroing.cit.network.Protocol |
getProtocol()
Returns the currently set
Protocol . |
int |
getReceiveBufferSize()
Returns the size of the buffer containing the received data.
|
int |
getSendBufferSize()
Returns the size of the buffer containing the data to send.
|
int |
getThreadCount()
Returns the
Thread count to use when processing events. |
boolean |
isDisconnectOnUnbindEnabled()
Returns
true if, and only if, disconnection should occur on unbind, false otherwise. |
boolean |
isTCPNoDelayEnabled()
Returns the current TCP_NODELAY configuration.
|
static ServerConfiguration |
newInstance()
Returns a new
ServerConfiguration instance. |
void |
setDisconnectOnUnbindEnabled(boolean isDisconnectOnUnbindEnabled)
Sets the disconnect on unbind configuration for this
ServerConfiguration instance. |
void |
setExecutor(java.util.concurrent.Executor executor)
Sets the
Executor that will be used to process events. |
void |
setHostname(java.lang.String hostname)
Sets a hostname for this
ServerConfiguration . |
void |
setPort(int port)
Sets a port for this
ServerConfiguration . |
void |
setProtocol(org.macroing.cit.network.Protocol protocol)
Sets a
Protocol for this ServerConfiguration . |
void |
setReceiveBufferSize(int receiveBufferSize)
Sets the size of the buffer that will contain received data.
|
void |
setSendBufferSize(int sendBufferSize)
Sets the size of the buffer that will contain data to be sent.
|
void |
setTCPNoDelayEnabled(boolean isTCPNoDelayEnabled)
Sets a new TCP_NODELAY configuration for this
ServerConfiguration . |
void |
setThreadCount(int threadCount)
Sets the
Thread count that will be used when processing events. |
public static final int DOMAIN_NAME_SYSTEM_53
53
.public static final int FILE_TRANSFER_PROTOCOL_20
20
.public static final int FILE_TRANSFER_PROTOCOL_21
21
.public static final int HYPERTEXT_TRANSFER_PROTOCOL_SECURE_443
443
.public static final int HYPERTEXT_TRANSFER_PROTOCOL_80
80
.public static final int INTERNET_MESSAGE_ACCESS_PROTOCOL_143
143
.public static final int NETWORK_NEWS_TRANSFER_PROTOCOL_119
119
.public static final int PORT_NUMBER_MAXIMUM
public static final int PORT_NUMBER_MINIMUM
public static final int POST_OFFICE_PROTOCOL_110
110
.public static final int SECURE_SHELL_22
22
.public static final int SIMPLE_MAIL_TRANSFER_PROTOCOL_25
25
.public static final int SIMPLE_NETWORK_MANAGEMENT_PROTOCOL_161
161
.public static final int TELNET_23
23
.public boolean isDisconnectOnUnbindEnabled()
true
if, and only if, disconnection should occur on unbind, false
otherwise.
By default, this configuration is turned on.
true
if, and only if, disconnection should occur on unbind, false
otherwisepublic boolean isTCPNoDelayEnabled()
By default, TCP_NODELAY will be turned off.
public java.util.concurrent.Executor getExecutor()
Executor
that will process events.
By default, Executors.newCachedThreadPool()
will be used.
Executor
that will process eventspublic int getPort()
If no port has been explicitly set, ServerConfiguration.HYPERTEXT_TRANSFER_PROTOCOL_80
will be returned.
public int getReceiveBufferSize()
By default, the size is set to 5000
.
public int getSendBufferSize()
By default, the size is set to 5000
.
public int getThreadCount()
Thread
count to use when processing events.
By default, the count is set to Runtime.getRuntime().availableProcessors() + 1
.
Thread
count to use when processing eventspublic org.macroing.cit.network.Protocol getProtocol()
Protocol
.
If no Protocol
has been explicitly set, a default Protocol
will be returned.
This default Protocol
forwards the Message
as is, and no transformations or optimizations are performed.
Protocol
public java.lang.String getHostname()
If no hostname has been explicitly set, a default hostname will be returned.
This default hostname is "127.0.0.1"
.
public void setDisconnectOnUnbindEnabled(boolean isDisconnectOnUnbindEnabled)
ServerConfiguration
instance.
By default, this configuration is turned on.
isDisconnectOnUnbindEnabled
- true
if, and only if, unbinding should cause disconnection, false
otherwisepublic void setExecutor(java.util.concurrent.Executor executor)
Executor
that will be used to process events.
By default, Executors.newCachedThreadPool()
will be used.
If executor
is null
, a NullPointerException
will be thrown.
executor
- the Executor
that will be used to process eventsjava.lang.NullPointerException
- thrown if, and only if, executor
is null
public void setHostname(java.lang.String hostname)
ServerConfiguration
.
If hostname
is null
, a NullPointerException
will be thrown.
hostname
- the hostname to setjava.lang.NullPointerException
- thrown if, and only if, hostname
is null
public void setPort(int port)
ServerConfiguration
.
If port
is less than ServerConfiguration.PORT_NUMBER_MINIMUM
, or greater than ServerConfiguration.PORT_NUMBER_MAXIMUM
, an IllegalArgumentException
will be thrown.
port
- the port to setjava.lang.IllegalArgumentException
- thrown if, and only if, port
is less than ServerConfiguration.PORT_NUMBER_MINIMUM
, or greater than ServerConfiguration.PORT_NUMBER_MAXIMUM
public void setProtocol(org.macroing.cit.network.Protocol protocol)
Protocol
for this ServerConfiguration
.
If protocol
is null
, a NullPointerException
will be thrown.
protocol
- the Protocol
to be setjava.lang.NullPointerException
- thrown if, and only if, protocol
is null
public void setReceiveBufferSize(int receiveBufferSize)
By default, the size is set to 5000
.
If receiveBufferSize
is less than 0
, an IllegalArgumentException
will be thrown.
receiveBufferSize
- the size of the buffer that will contain received datajava.lang.IllegalArgumentException
- thrown if, and only if, receiveBufferSize
is less than 0
public void setSendBufferSize(int sendBufferSize)
By default, the size is set to 5000
.
If sendBufferSize
is less than 0
, an IllegalArgumentException
will be thrown.
sendBufferSize
- the size of the buffer that will contain data to be sentjava.lang.IllegalArgumentException
- thrown if, and only if, sendBufferSize
is less than 0
public void setTCPNoDelayEnabled(boolean isTCPNoDelayEnabled)
ServerConfiguration
.
By default, TCP_NODELAY will be turned off.
isTCPNoDelayEnabled
- the TCP_NODELAY configuration to usepublic void setThreadCount(int threadCount)
Thread
count that will be used when processing events.
By default, the count is set to Runtime.getRuntime().availableProcessors() + 1
.
If threadCount
is less than 1
, an IllegalArgumentException
will be thrown.
threadCount
- the Thread
count that will be used when processing eventsjava.lang.IllegalArgumentException
- thrown if, and only if, threadCount
is less than 1
public static ServerConfiguration newInstance()
ServerConfiguration
instance.ServerConfiguration
instance