@ThreadSafe public class DefaultMCMPHandler extends Object implements MCMPHandler
MCMPHandler
.Modifier and Type | Class and Description |
---|---|
static class |
DefaultMCMPHandler.VirtualHostImpl |
Constructor and Description |
---|
DefaultMCMPHandler(MCMPHandlerConfiguration config,
ResetRequestSource source,
MCMPRequestFactory requestFactory,
MCMPResponseParser responseParser) |
Modifier and Type | Method and Description |
---|---|
void |
addProxy(InetSocketAddress socketAddress)
Add a proxy to the list of those with which this handler communicates.
|
void |
addProxy(InetSocketAddress socketAddress,
boolean established)
Add a proxy to the list of those with which this handler communicates.
|
void |
addProxy(ProxyConfiguration proxyConfiguration)
Add a proxy to the list of those with which this handler communicates.
|
void |
addProxy(ProxyConfiguration proxyConfiguration,
boolean established)
Add a proxy to the list of those with which this handler communicates.
|
Set<MCMPServerState> |
getProxyStates()
Get the state of all proxies
|
void |
init(Collection<ProxyConfiguration> proxies,
MCMPConnectionListener connectionListener)
Initialization method for MCMP handler.
|
boolean |
isProxyHealthOK()
Convenience method that checks whether the status of all proxies is
OK . |
void |
markProxiesInError()
|
void |
removeProxy(InetSocketAddress socketAddress)
Remove a proxy from the list of those with which this handler communicates.
|
void |
reset()
|
Map<MCMPServerState,String> |
sendRequest(MCMPRequest request)
Send a request to all healthy proxies.
|
Map<MCMPServerState,List<String>> |
sendRequests(List<MCMPRequest> requests)
Send a list of requests to all healthy proxies, with all requests in the list sent to each proxy before moving on to the
next.
|
void |
shutdown()
Perform any shut down work.
|
void |
status()
Perform periodic processing.
|
public DefaultMCMPHandler(MCMPHandlerConfiguration config, ResetRequestSource source, MCMPRequestFactory requestFactory, MCMPResponseParser responseParser)
public void init(Collection<ProxyConfiguration> proxies, MCMPConnectionListener connectionListener)
MCMPHandler
init
in interface MCMPHandler
proxies
- a collection of initial ProxyConfiguration
sconnectionListener
- connection listenerpublic void shutdown()
MCMPHandler
shutdown
in interface MCMPHandler
public void addProxy(InetSocketAddress socketAddress)
MCMPHandler
MCMPHandler.status()
.
Same as addProxy(address, false
.
addProxy
in interface MCMPHandler
socketAddress
- InetSocketAddress on which the proxy listens for MCMP requestspublic void addProxy(ProxyConfiguration proxyConfiguration)
MCMPHandler
MCMPHandler.status()
.
Same as addProxy(proxyConfiguration, false)
.
addProxy
in interface MCMPHandler
proxyConfiguration
- ProxyConfiguration
defining address on which the proxy listens for MCMP requests
and optional local address to bind connections topublic void addProxy(InetSocketAddress socketAddress, boolean established)
MCMPHandler
MCMPHandler.status()
.addProxy
in interface MCMPHandler
socketAddress
- InetSocketAddress on which the proxy listens for MCMP requestsestablished
- true
if the proxy should be considered established
,
false
otherwise.public void addProxy(ProxyConfiguration proxyConfiguration, boolean established)
MCMPHandler
MCMPHandler.status()
.addProxy
in interface MCMPHandler
proxyConfiguration
- ProxyConfiguration
defining address on which the proxy listens for MCMP requests
and optional local address to bind connections toestablished
- true
if the proxy should be considered established
,
false
otherwise.public void removeProxy(InetSocketAddress socketAddress)
MCMPHandler
MCMPHandler.status()
.removeProxy
in interface MCMPHandler
socketAddress
- InetSocketAddress on which the proxy listens for MCMP requestspublic Set<MCMPServerState> getProxyStates()
MCMPHandler
getProxyStates
in interface MCMPHandler
public boolean isProxyHealthOK()
MCMPHandler
OK
.isProxyHealthOK
in interface MCMPHandler
true
if all proxies are OK
, false
otherwisepublic void markProxiesInError()
MCMPHandler
OK
down to ERROR
, which will
trigger a refresh of their configuration.markProxiesInError
in interface MCMPHandler
public void reset()
MCMPHandler
reset
in interface MCMPHandler
public void status()
MCMPHandler
addProxy(...)
or
removeProxy(...)
. Attempt to establish communication with any proxies whose state is
ERROR
. If successful and a ResetRequestSource
has been provided, update the proxy
with the list of requests provided by the source.status
in interface MCMPHandler
public Map<MCMPServerState,String> sendRequest(MCMPRequest request)
MCMPHandler
sendRequest
in interface MCMPHandler
request
- the request. Cannot be null
public Map<MCMPServerState,List<String>> sendRequests(List<MCMPRequest> requests)
MCMPHandler
sendRequests
in interface MCMPHandler
requests
- the requests. Cannot be null
Copyright © 2023 JBoss by Red Hat. All rights reserved.