Package org.jboss.modcluster.mcmp.impl
Class DefaultMCMPHandler
- java.lang.Object
-
- org.jboss.modcluster.mcmp.impl.DefaultMCMPHandler
-
- All Implemented Interfaces:
MCMPHandler
@ThreadSafe public class DefaultMCMPHandler extends Object implements MCMPHandler
Default implementation ofMCMPHandler
.- Author:
- Jean-Frederic Clere, Brian Stansberry, Paul Ferraro
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
DefaultMCMPHandler.VirtualHostImpl
-
Constructor Summary
Constructors Constructor Description DefaultMCMPHandler(MCMPHandlerConfiguration config, ResetRequestSource source, MCMPRequestFactory requestFactory, MCMPResponseParser responseParser)
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
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.Set<MCMPServerState>
getProxyStates()
Get the state of all proxiesvoid
init(Collection<ProxyConfiguration> proxies, MCMPConnectionListener connectionListener)
Initialization method for MCMP handler.boolean
isProxyHealthOK()
Convenience method that checks whether the status of all proxies isOK
.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.
-
-
-
Constructor Detail
-
DefaultMCMPHandler
public DefaultMCMPHandler(MCMPHandlerConfiguration config, ResetRequestSource source, MCMPRequestFactory requestFactory, MCMPResponseParser responseParser)
-
-
Method Detail
-
init
public void init(Collection<ProxyConfiguration> proxies, MCMPConnectionListener connectionListener)
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 public void addProxy(InetSocketAddress socketAddress)
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
public void addProxy(ProxyConfiguration proxyConfiguration)
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 public void addProxy(InetSocketAddress socketAddress, boolean established)
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
public void addProxy(ProxyConfiguration proxyConfiguration, boolean established)
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
public void removeProxy(InetSocketAddress socketAddress)
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
public Set<MCMPServerState> 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
public Map<MCMPServerState,String> sendRequest(MCMPRequest request)
Description copied from interface:MCMPHandler
Send a request to all healthy proxies.- Specified by:
sendRequest
in interfaceMCMPHandler
- Parameters:
request
- the request. Cannot benull
-
sendRequests
public Map<MCMPServerState,List<String>> sendRequests(List<MCMPRequest> requests)
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
-
-