public class NetworkFactory extends Object
Constructor and Description |
---|
NetworkFactory(int threadCount,
long spinningTimeout,
boolean isDaemon)
Creates a new NetworkFactory with the specified number of threads, spinning timeout, and daemon thread flag
for the services network-related object use.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Shuts down the factory, releasing any resources that were created by it.
|
Acceptor |
makeAcceptor()
Creates a new
Acceptor object. |
SocketConnector |
makeSocketConnector(String host,
int port,
long timeout,
TimeUnit timeUnit,
PortRange localPortRange,
SocketAddress bindAddr,
ProxySettings proxySettings)
Creates a new
SocketConnector object with the specified parameters. |
TcpConnection |
makeTcpConnection(Socket socket,
SSLEngine sslEngine,
ConnectionMode mode)
Creates a new
TcpConnection object with the specified parameters. |
public NetworkFactory(int threadCount, long spinningTimeout, boolean isDaemon)
threadCount
- the number of threads to use for servicesspinningTimeout
- the timeout to use for spinning in servicesisDaemon
- a flag indicating whether the services threads should be daemon threadspublic void close()
public Acceptor makeAcceptor()
Acceptor
object.Acceptor
objectpublic SocketConnector makeSocketConnector(String host, int port, long timeout, TimeUnit timeUnit, PortRange localPortRange, SocketAddress bindAddr, ProxySettings proxySettings)
SocketConnector
object with the specified parameters.host
- the hostname or IP address to connect toport
- the port to connect totimeout
- the timeout for the connection attempttimeUnit
- the time unit for the timeoutlocalPortRange
- the local port range to use for the connectionbindAddr
- the local address to bind toproxySettings
- the ProxySettings
to be used, null if no proxy neededSocketConnector
objectpublic TcpConnection makeTcpConnection(Socket socket, SSLEngine sslEngine, ConnectionMode mode)
TcpConnection
object with the specified parameters.socket
- the Socket
to use for the connectionsslEngine
- the SSLEngine to use for SSL/TLS connectionsmode
- the connection mode (see ConnectionMode
)TcpConnection
objectCopyright © 2005–2024 Onix Solutions. All rights reserved.