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 classDefaultMCMPHandler.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 voidaddProxy(InetSocketAddress socketAddress)Deprecated.voidaddProxy(InetSocketAddress socketAddress, boolean established)Deprecated.voidaddProxy(ProxyConfiguration proxyConfiguration)Add a proxy to the list of those with which this handler communicates.voidaddProxy(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 proxiesvoidinit(Collection<ProxyConfiguration> proxies, MCMPConnectionListener connectionListener)Initialization method for MCMP handler.booleanisProxyHealthOK()Convenience method that checks whether the status of all proxies isOK.voidmarkProxiesInError()voidremoveProxy(InetSocketAddress socketAddress)Remove a proxy from the list of those with which this handler communicates.voidreset()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.voidshutdown()Perform any shut down work.voidstatus()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:MCMPHandlerInitialization method for MCMP handler.- Specified by:
initin interfaceMCMPHandler- Parameters:
proxies- a collection of initialProxyConfigurationsconnectionListener- connection listener
-
shutdown
public void shutdown()
Description copied from interface:MCMPHandlerPerform any shut down work.- Specified by:
shutdownin interfaceMCMPHandler
-
addProxy
@Deprecated public void addProxy(InetSocketAddress socketAddress)
Deprecated.Description copied from interface:MCMPHandlerAdd 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:
addProxyin interfaceMCMPHandler- Parameters:
socketAddress- InetSocketAddress on which the proxy listens for MCMP requests
-
addProxy
public void addProxy(ProxyConfiguration proxyConfiguration)
Description copied from interface:MCMPHandlerAdd 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:
addProxyin interfaceMCMPHandler- Parameters:
proxyConfiguration-ProxyConfigurationdefining 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:MCMPHandlerAdd a proxy to the list of those with which this handler communicates. Communication does not begin until the next call toMCMPHandler.status().- Specified by:
addProxyin interfaceMCMPHandler- Parameters:
socketAddress- InetSocketAddress on which the proxy listens for MCMP requestsestablished-trueif the proxy should be consideredestablished,falseotherwise.
-
addProxy
public void addProxy(ProxyConfiguration proxyConfiguration, boolean established)
Description copied from interface:MCMPHandlerAdd a proxy to the list of those with which this handler communicates. Communication does not begin until the next call toMCMPHandler.status().- Specified by:
addProxyin interfaceMCMPHandler- Parameters:
proxyConfiguration-ProxyConfigurationdefining address on which the proxy listens for MCMP requests and optional local address to bind connections toestablished-trueif the proxy should be consideredestablished,falseotherwise.
-
removeProxy
public void removeProxy(InetSocketAddress socketAddress)
Description copied from interface:MCMPHandlerRemove a proxy from the list of those with which this handler communicates. Communication does not end until the next call toMCMPHandler.status().- Specified by:
removeProxyin interfaceMCMPHandler- Parameters:
socketAddress- InetSocketAddress on which the proxy listens for MCMP requests
-
getProxyStates
public Set<MCMPServerState> getProxyStates()
Description copied from interface:MCMPHandlerGet the state of all proxies- Specified by:
getProxyStatesin 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:MCMPHandlerConvenience method that checks whether the status of all proxies isOK.- Specified by:
isProxyHealthOKin interfaceMCMPHandler- Returns:
trueif all proxies areOK,falseotherwise
-
markProxiesInError
public void markProxiesInError()
Description copied from interface:MCMPHandlerReset any proxies whose status isOKdown toERROR, which will trigger a refresh of their configuration.- Specified by:
markProxiesInErrorin interfaceMCMPHandler
-
reset
public void reset()
Description copied from interface:MCMPHandler- Specified by:
resetin interfaceMCMPHandler
-
status
public void status()
Description copied from interface:MCMPHandlerPerform 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 aResetRequestSourcehas been provided, update the proxy with the list of requests provided by the source.- Specified by:
statusin interfaceMCMPHandler
-
sendRequest
public Map<MCMPServerState,String> sendRequest(MCMPRequest request)
Description copied from interface:MCMPHandlerSend a request to all healthy proxies.- Specified by:
sendRequestin interfaceMCMPHandler- Parameters:
request- the request. Cannot benull
-
sendRequests
public Map<MCMPServerState,List<String>> sendRequests(List<MCMPRequest> requests)
Description copied from interface:MCMPHandlerSend 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:
sendRequestsin interfaceMCMPHandler- Parameters:
requests- the requests. Cannot benull
-
-