Package org.jboss.modcluster.mcmp.impl
Class DefaultMCMPHandler
java.lang.Object
org.jboss.modcluster.mcmp.impl.DefaultMCMPHandler
- All Implemented Interfaces:
MCMPHandler
Default implementation of
MCMPHandler
.- Author:
- Jean-Frederic Clere, Brian Stansberry, Paul Ferraro
-
Nested Class Summary
-
Constructor Summary
ConstructorDescriptionDefaultMCMPHandler
(MCMPHandlerConfiguration config, ResetRequestSource source, MCMPRequestFactory requestFactory, MCMPResponseParser responseParser) -
Method Summary
Modifier and TypeMethodDescriptionvoid
addProxy
(InetSocketAddress socketAddress) Deprecated.void
addProxy
(InetSocketAddress socketAddress, boolean established) Deprecated.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.Get the state of all proxiesvoid
init
(Collection<ProxyConfiguration> proxies, MCMPConnectionListener connectionListener) Initialization method for MCMP handler.boolean
Convenience method that checks whether the status of all proxies isOK
.void
void
removeProxy
(InetSocketAddress socketAddress) Remove a proxy from the list of those with which this handler communicates.void
reset()
sendRequest
(MCMPRequest request) Send a request to all healthy proxies.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.
-
Constructor Details
-
DefaultMCMPHandler
public DefaultMCMPHandler(MCMPHandlerConfiguration config, ResetRequestSource source, MCMPRequestFactory requestFactory, MCMPResponseParser responseParser)
-
-
Method Details
-
init
Description copied from interface:MCMPHandler
Initialization method for MCMP handler.- Specified by:
init
in interfaceMCMPHandler
- Parameters:
proxies
- a collection of initialProxyConfiguration
sconnectionListener
- connection listener
-
shutdown
public void shutdown()Description copied from interface:MCMPHandler
Perform any shut down work.- Specified by:
shutdown
in interfaceMCMPHandler
-
addProxy
Deprecated.Description copied from interface:MCMPHandler
Add a proxy to the list of those with which this handler communicates. Communication does not begin until the next call toMCMPHandler.status()
.Same as
addProxy(address, false
.- Specified by:
addProxy
in interfaceMCMPHandler
- Parameters:
socketAddress
- InetSocketAddress on which the proxy listens for MCMP requests
-
addProxy
Description copied from interface:MCMPHandler
Add a proxy to the list of those with which this handler communicates. Communication does not begin until the next call toMCMPHandler.status()
.Same as
addProxy(proxyConfiguration, false)
.- Specified by:
addProxy
in interfaceMCMPHandler
- Parameters:
proxyConfiguration
-ProxyConfiguration
defining address on which the proxy listens for MCMP requests and optional local address to bind connections to
-
addProxy
Deprecated.Description copied from interface:MCMPHandler
Add a proxy to the list of those with which this handler communicates. Communication does not begin until the next call toMCMPHandler.status()
.- Specified by:
addProxy
in interfaceMCMPHandler
- Parameters:
socketAddress
- InetSocketAddress on which the proxy listens for MCMP requestsestablished
-true
if the proxy should be consideredestablished
,false
otherwise.
-
addProxy
Description copied from interface:MCMPHandler
Add a proxy to the list of those with which this handler communicates. Communication does not begin until the next call toMCMPHandler.status()
.- Specified by:
addProxy
in interfaceMCMPHandler
- Parameters:
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 consideredestablished
,false
otherwise.
-
removeProxy
Description copied from interface:MCMPHandler
Remove a proxy from the list of those with which this handler communicates. Communication does not end until the next call toMCMPHandler.status()
.- Specified by:
removeProxy
in interfaceMCMPHandler
- Parameters:
socketAddress
- InetSocketAddress on which the proxy listens for MCMP requests
-
getProxyStates
Description copied from interface:MCMPHandler
Get the state of all proxies- Specified by:
getProxyStates
in interfaceMCMPHandler
- Returns:
- a set of status objects indicating the status of this handler's communication with all proxies.
-
isProxyHealthOK
public boolean isProxyHealthOK()Description copied from interface:MCMPHandler
Convenience method that checks whether the status of all proxies isOK
.- Specified by:
isProxyHealthOK
in interfaceMCMPHandler
- Returns:
true
if all proxies areOK
,false
otherwise
-
markProxiesInError
public void markProxiesInError()Description copied from interface:MCMPHandler
Reset any proxies whose status isOK
down toERROR
, which will trigger a refresh of their configuration.- Specified by:
markProxiesInError
in interfaceMCMPHandler
-
reset
public void reset()Description copied from interface:MCMPHandler
- Specified by:
reset
in interfaceMCMPHandler
-
status
public void status()Description copied from interface:MCMPHandler
Perform periodic processing. Update the list of proxies to reflect any calls toaddProxy(...)
orremoveProxy(...)
. Attempt to establish communication with any proxies whose state isERROR
. If successful and aResetRequestSource
has been provided, update the proxy with the list of requests provided by the source.- Specified by:
status
in interfaceMCMPHandler
-
sendRequest
Description copied from interface:MCMPHandler
Send a request to all healthy proxies.- Specified by:
sendRequest
in interfaceMCMPHandler
- Parameters:
request
- the request. Cannot benull
-
sendRequests
Description copied from interface:MCMPHandler
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.- Specified by:
sendRequests
in interfaceMCMPHandler
- Parameters:
requests
- the requests. Cannot benull
-