public class ServerGroup extends Object
registerProxyServer(HttpProxyManager), and when they shut down, must unregister with the
ServerGroup using unregisterProxyServer(HttpProxyManager, boolean).| 限定符和类型 | 字段和说明 |
|---|---|
private int |
eventGroupAwaitTimeoutSeconds |
private long |
eventGroupGracefulShutdownQuietPeriodSeconds |
private long |
eventGroupGracefulShutdownTimeoutSeconds |
private int |
incomingAcceptorThreads |
private int |
incomingWorkerIoRatio |
private int |
incomingWorkerThreads |
private static org.slf4j.Logger |
LOG |
private String |
name |
private int |
outgoingWorkerIoRatio |
private int |
outgoingWorkerThreads |
private EnumMap<TransportProtocol,ProxyThreadPools> |
protocolThreadPools |
List<HttpProxyManager> |
registeredServers |
private Object |
SERVER_REGISTRATION_LOCK
Lock controlling access to the
registerProxyServer(HttpProxyManager) and
unregisterProxyServer(HttpProxyManager, boolean) methods. |
private static AtomicInteger |
serverGroupCount |
private int |
serverGroupId |
private AtomicBoolean |
stopped |
private Object |
threadPoolInitLock |
private static EnumMap<TransportProtocol,SelectorProvider> |
TRANSPORT_PROTOCOL_SELECTOR_PROVIDERS |
| 构造器和说明 |
|---|
ServerGroup(String name,
int incomingAcceptorThreads,
int incomingWorkerThreads,
int outgoingWorkerThreads)
已过时。
|
ServerGroup(String name,
int incomingAcceptorThreads,
int incomingWorkerThreads,
int incomingWorkerIoRatio,
int outgoingWorkerThreads,
int outgoingWorkerIoRatio,
long eventGroupGracefulShutdownQuietPeriodSeconds,
long eventGroupGracefulShutdownTimeoutSeconds,
int eventGroupAwaitTimeoutSeconds) |
| 限定符和类型 | 方法和说明 |
|---|---|
EventLoopGroup |
getClientToProxyAcceptorPoolForTransport(TransportProtocol protocol)
Retrieves the client-to-proxy acceptor thread pool for the specified protocol.
|
EventLoopGroup |
getClientToProxyWorkerPoolForTransport(TransportProtocol protocol)
Retrieves the client-to-proxy acceptor worker pool for the specified protocol.
|
EventLoopGroup |
getProxyToServerWorkerPoolForTransport(TransportProtocol protocol)
Retrieves the proxy-to-server worker thread pool for the specified protocol.
|
private ProxyThreadPools |
getThreadPoolsForProtocol(TransportProtocol protocol)
Retrieves the
ProxyThreadPools for the specified transport protocol. |
boolean |
isStopped() |
void |
registerProxyServer(HttpProxyManager proxyServer)
Registers the specified proxy server as a consumer of this server group.
|
private void |
shutdown(boolean graceful)
Shuts down all event loops owned by this server group.
|
void |
unregisterProxyServer(HttpProxyManager proxyServer,
boolean graceful)
Unregisters the specified proxy server from this server group.
|
private static final org.slf4j.Logger LOG
private static final EnumMap<TransportProtocol,SelectorProvider> TRANSPORT_PROTOCOL_SELECTOR_PROVIDERS
private static final AtomicInteger serverGroupCount
private final String name
private final int serverGroupId
private final int incomingAcceptorThreads
private final int incomingWorkerThreads
private final int incomingWorkerIoRatio
private final int outgoingWorkerThreads
private final int outgoingWorkerIoRatio
private final long eventGroupGracefulShutdownQuietPeriodSeconds
private final long eventGroupGracefulShutdownTimeoutSeconds
private final int eventGroupAwaitTimeoutSeconds
public final List<HttpProxyManager> registeredServers
private final EnumMap<TransportProtocol,ProxyThreadPools> protocolThreadPools
private final Object threadPoolInitLock
private final AtomicBoolean stopped
private final Object SERVER_REGISTRATION_LOCK
registerProxyServer(HttpProxyManager) and
unregisterProxyServer(HttpProxyManager, boolean) methods.@Deprecated public ServerGroup(String name, int incomingAcceptorThreads, int incomingWorkerThreads, int outgoingWorkerThreads)
public ServerGroup(String name, int incomingAcceptorThreads, int incomingWorkerThreads, int incomingWorkerIoRatio, int outgoingWorkerThreads, int outgoingWorkerIoRatio, long eventGroupGracefulShutdownQuietPeriodSeconds, long eventGroupGracefulShutdownTimeoutSeconds, int eventGroupAwaitTimeoutSeconds)
private ProxyThreadPools getThreadPoolsForProtocol(TransportProtocol protocol)
ProxyThreadPools for the specified transport protocol. Lazily initializes the thread pools
for the transport protocol if they have not yet been initialized. If the protocol has already been initialized,
this method returns immediately, without synchronization. If initialization is necessary, the initialization
process creates the acceptor and worker threads necessary to service requests to/from the proxy.
This method is thread-safe; no external locking is necessary.
protocol - transport protocol to retrieve thread pools forpublic void registerProxyServer(HttpProxyManager proxyServer)
proxyServer - proxy server instance to registerpublic void unregisterProxyServer(HttpProxyManager proxyServer, boolean graceful)
proxyServer - proxy server instance to unregistergraceful - when true, the server group shutdown (if necessary) will be gracefulprivate void shutdown(boolean graceful)
graceful - when true, event loops will "gracefully" terminate, waiting for submitted tasks to finishpublic EventLoopGroup getClientToProxyAcceptorPoolForTransport(TransportProtocol protocol)
This method is thread-safe; no external locking is necessary.
protocol - transport protocol to retrieve the thread pool forpublic EventLoopGroup getClientToProxyWorkerPoolForTransport(TransportProtocol protocol)
This method is thread-safe; no external locking is necessary.
protocol - transport protocol to retrieve the thread pool forpublic EventLoopGroup getProxyToServerWorkerPoolForTransport(TransportProtocol protocol)
This method is thread-safe; no external locking is necessary.
protocol - transport protocol to retrieve the thread pool forpublic boolean isStopped()
Copyright © 2021 Zodiac. All rights reserved.