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(ExternalService externalService)
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,
ExternalService externalService)
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(ExternalService externalService)
Acceptor
object.externalService
- external service to handle acceptor eventsAcceptor
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, ExternalService externalService)
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
)externalService
- the external service to handle connection eventsTcpConnection
objectCopyright © 2005–2024 Onix Solutions. All rights reserved.