Package org.jboss.modcluster
Class ModClusterService
java.lang.Object
org.jboss.modcluster.ModClusterService
- All Implemented Interfaces:
ContainerEventHandler,LoadBalanceFactorProvider,ContextFilter,MCMPConnectionListener,ModClusterServiceMBean
public class ModClusterService
extends Object
implements ModClusterServiceMBean, ContainerEventHandler, LoadBalanceFactorProvider, MCMPConnectionListener, ContextFilter
-
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionModClusterService(ModClusterConfig config, LoadBalanceFactorProvider loadBalanceFactorProvider) ModClusterService(ModClusterConfig config, LoadBalanceFactorProviderFactory loadBalanceFactorProviderFactory) ModClusterService(ModClusterConfiguration config, LoadBalanceFactorProvider loadBalanceFactorProvider) protectedModClusterService(NodeConfiguration nodeConfig, BalancerConfiguration balancerConfig, MCMPHandlerConfiguration mcmpConfig, AdvertiseConfiguration advertiseConfig, LoadBalanceFactorProviderFactory loadBalanceFactorProviderFactory, MCMPRequestFactory requestFactory, MCMPResponseParser responseParser, ResetRequestSource resetRequestSource, MCMPHandler mcmpHandler, AdvertiseListenerFactory listenerFactory) -
Method Summary
Modifier and TypeMethodDescriptionvoidIndicates the deployment of a new web application which is not intending to start immediately.voidAdd a proxy to the list of those with which this handler communicates.protected voidConfigures the specified engine.voidconnectionEstablished(InetAddress localAddress) booleandisable()Disable all webapps for all engines.booleandisableContext(String host, String path) Disables the webapp with the specified host and context path.booleanenable()Enable all webapps for all engines.booleanenableContext(String host, String path) Enables the webapp with the specified host and context path.protected voidestablishJvmRoute(Engine engine) getExcludedContexts(Host host) Returns the contexts that will *not* be registered in any proxy for the given host.intgetLoadBalanceFactor(Engine engine) Retrieves the full proxy configuration.Retrieves the full proxy info message.voidTriggers the initialization of mod_cluster.booleanIndicates when contexts should auto-enable by default.booleanping()Ping httpd. determines whether each proxy is accessible and healthy. returning the PING_RSP grouped by proxy address.Ping a node from httpd. returning the PING_RSP grouped by proxy address. determines whether the node configured with the specified jvm route is accessible from each proxy returning the PING_RSP grouped by proxy address.Ping a node defined protocol, host and port from httpd. determines whether a node (not necessarily configured) with the matching connector is accessible from each proxyvoidrefresh()Refresh configuration.voidIndicates the undeployment of the specified context.protected voidSends REMOVE-APP *, if engine was initializedvoidremoveProxy(String host, int port) Remove a proxy from the list of those with which this handler communicates.voidreset()Reset a DOWN connection to the proxy up to ERROR, where the configuration will be refreshed.voidshutdown()Triggers the shutdown of mod_cluster.voidIndicates the specified web application context was started.voidIndicates the servlet container has been started.voidThis is a periodic event that triggers a STATUS command containing newly calculated load factor.booleanAttempts to gracefully stops all web applications, within the specified timeout.voidIndicates the specified web application context was stopped.voidIndicates the servlet container has been stopped.booleanstopContext(String host, String path, long timeout, TimeUnit unit) Attempts to gracefully stops a single web application, within the specified timeout.
-
Field Details
-
DEFAULT_PORT
public static final int DEFAULT_PORT- See Also:
-
-
Constructor Details
-
ModClusterService
public ModClusterService(ModClusterConfiguration config, LoadBalanceFactorProvider loadBalanceFactorProvider) -
ModClusterService
public ModClusterService(ModClusterConfig config, LoadBalanceFactorProvider loadBalanceFactorProvider) -
ModClusterService
public ModClusterService(ModClusterConfig config, LoadBalanceFactorProviderFactory loadBalanceFactorProviderFactory) -
ModClusterService
protected ModClusterService(NodeConfiguration nodeConfig, BalancerConfiguration balancerConfig, MCMPHandlerConfiguration mcmpConfig, AdvertiseConfiguration advertiseConfig, LoadBalanceFactorProviderFactory loadBalanceFactorProviderFactory, MCMPRequestFactory requestFactory, MCMPResponseParser responseParser, ResetRequestSource resetRequestSource, MCMPHandler mcmpHandler, AdvertiseListenerFactory listenerFactory)
-
-
Method Details
-
init
Description copied from interface:ContainerEventHandlerTriggers the initialization of mod_cluster. This event should be triggered only once, after the startup of the servlet container, but before triggering theContainerEventHandler.start(Server)event.- Specified by:
initin interfaceContainerEventHandler- Parameters:
server- a server
-
getExcludedContexts
Description copied from interface:ContextFilterReturns the contexts that will *not* be registered in any proxy for the given host.- Specified by:
getExcludedContextsin interfaceContextFilter- Returns:
- a set of context paths excluded for the given host
-
isAutoEnableContexts
public boolean isAutoEnableContexts()Description copied from interface:ContextFilterIndicates when contexts should auto-enable by default. If auto-enable is off, then contexts are disabled by default and must be enabled manually.- Specified by:
isAutoEnableContextsin interfaceContextFilter- Returns:
- true, contexts should be auto-enabled, false otherwise.
-
shutdown
public void shutdown()Description copied from interface:ContainerEventHandlerTriggers the shutdown of mod_cluster. Closes any resources created inContainerEventHandler.init(Server).- Specified by:
shutdownin interfaceContainerEventHandler
-
start
Description copied from interface:ContainerEventHandlerIndicates the servlet container has been started. This event triggers the configuration of each servlet engine, and the addition of all web application contexts.- Specified by:
startin interfaceContainerEventHandler- Parameters:
server- the started server
-
stop
Description copied from interface:ContainerEventHandlerIndicates the servlet container has been stopped. This event triggers the removal of all web application contexts, and REMOVE-APP * of each engine.- Specified by:
stopin interfaceContainerEventHandler- Parameters:
server- the stopped server
-
config
Configures the specified engine. Sends CONFIG request. -
isEstablished
public boolean isEstablished()- Specified by:
isEstablishedin interfaceMCMPConnectionListener
-
connectionEstablished
- Specified by:
connectionEstablishedin interfaceMCMPConnectionListener
-
establishJvmRoute
-
add
Description copied from interface:ContainerEventHandlerIndicates the deployment of a new web application which is not intending to start immediately. This will issue a STOP-APP without session draining command on the proxies. In case the application will start useContainerEventHandler.start(Context).- Specified by:
addin interfaceContainerEventHandler- Parameters:
context- the added context
-
start
Description copied from interface:ContainerEventHandlerIndicates the specified web application context was started. This event triggers an ENABLE-APP command for the specified context.- Specified by:
startin interfaceContainerEventHandler- Parameters:
context- the started context
-
stop
Description copied from interface:ContainerEventHandlerIndicates the specified web application context was stopped. This event triggers a STOP-APP command for the context started byContainerEventHandler.start(Context).- Specified by:
stopin interfaceContainerEventHandler- Parameters:
context- the stopped context
-
remove
Description copied from interface:ContainerEventHandlerIndicates the undeployment of the specified context. This event triggers a REMOVE-APP command for the specified context.- Specified by:
removein interfaceContainerEventHandler- Parameters:
context- the removed context
-
removeAll
Sends REMOVE-APP *, if engine was initialized -
status
Description copied from interface:ContainerEventHandlerThis is a periodic event that triggers a STATUS command containing newly calculated load factor. This event also processing of newly added/discovered proxies, and reset of any proxies in error.- Specified by:
statusin interfaceContainerEventHandler- Parameters:
engine- the engine to be processed
-
getLoadBalanceFactor
- Specified by:
getLoadBalanceFactorin interfaceLoadBalanceFactorProvider
-
addProxy
Description copied from interface:ModClusterServiceMBeanAdd 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 interfaceModClusterServiceMBean- Parameters:
host- the hostname of the proxy; a string suitable for passing toInetAddress.getByHost(...)port- the port on which the proxy listens for MCMP requests
-
removeProxy
Description copied from interface:ModClusterServiceMBeanRemove 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 interfaceModClusterServiceMBean- Parameters:
host- the hostname of the proxy; a string suitable for passing toInetAddress.getByHost(...)port- the port on which the proxy listens for MCMP requests
-
getProxyConfiguration
Description copied from interface:ModClusterServiceMBeanRetrieves the full proxy configuration. response: node: [1:1] JVMRoute: node1 Domain: [bla] Host: 127.0.0.1 Port: 8009 Type: ajp host: 1 [] vhost: 1 node: 1 context: 1 [/] vhost: 1 node: 1 status: 1 context: 2 [/myapp] vhost: 1 node: 1 status: 1 context: 3 [/host-manager] vhost: 1 node: 1 status: 1 context: 4 [/docs] vhost: 1 node: 1 status: 1 context: 5 [/manager] vhost: 1 node: 1 status: 1 Sends aDUMPrequest to all proxies, returning the responses grouped by proxy address.- Specified by:
getProxyConfigurationin interfaceModClusterServiceMBean- Returns:
- a map of DUMP_RSP responses, grouped by proxy
-
getProxyInfo
Description copied from interface:ModClusterServiceMBeanRetrieves the full proxy info message. Sends anINFOrequest to all proxies, returning the responses grouped by proxy address.- Specified by:
getProxyInfoin interfaceModClusterServiceMBean- Returns:
- a map of INFO_RSP responses, grouped by proxy
-
ping
Description copied from interface:ModClusterServiceMBeanPing httpd. determines whether each proxy is accessible and healthy. returning the PING_RSP grouped by proxy address.- Specified by:
pingin interfaceModClusterServiceMBean- Returns:
- a map of PING_RSP responses, grouped by proxy
-
ping
Description copied from interface:ModClusterServiceMBeanPing a node from httpd. returning the PING_RSP grouped by proxy address. determines whether the node configured with the specified jvm route is accessible from each proxy returning the PING_RSP grouped by proxy address.- Specified by:
pingin interfaceModClusterServiceMBean- Parameters:
jvmRoute- a jvm route.- Returns:
- a map of PING_RSP responses, grouped by proxy
-
ping
Description copied from interface:ModClusterServiceMBeanPing a node defined protocol, host and port from httpd. determines whether a node (not necessarily configured) with the matching connector is accessible from each proxy- Specified by:
pingin interfaceModClusterServiceMBean- Parameters:
scheme- ajp, http or httpshost- name or IP of a the host- Returns:
- a map of PING_RSP responses, grouped by proxy
-
reset
public void reset()Description copied from interface:ModClusterServiceMBeanReset a DOWN connection to the proxy up to ERROR, where the configuration will be refreshed.- Specified by:
resetin interfaceModClusterServiceMBean
-
refresh
public void refresh()Description copied from interface:ModClusterServiceMBeanRefresh configuration.- Specified by:
refreshin interfaceModClusterServiceMBean
-
disable
public boolean disable()Description copied from interface:ModClusterServiceMBeanDisable all webapps for all engines.- Specified by:
disablein interfaceModClusterServiceMBean- Returns:
- true, if all proxies are responding normally, false otherwise
-
enable
public boolean enable()Description copied from interface:ModClusterServiceMBeanEnable all webapps for all engines.- Specified by:
enablein interfaceModClusterServiceMBean- Returns:
- true, if all proxies are responding normally, false otherwise
-
disableContext
Description copied from interface:ModClusterServiceMBeanDisables the webapp with the specified host and context path.- Specified by:
disableContextin interfaceModClusterServiceMBean- Parameters:
host- host name of the target webapppath- context path of the target webapp- Returns:
- true, if all proxies are responding normally, false otherwise
-
enableContext
Description copied from interface:ModClusterServiceMBeanEnables the webapp with the specified host and context path.- Specified by:
enableContextin interfaceModClusterServiceMBean- Parameters:
host- host name of the target webapppath- context path of the target webapp- Returns:
- true, if all proxies are responding normally, false otherwise
-
stop
Description copied from interface:ModClusterServiceMBeanAttempts to gracefully stops all web applications, within the specified timeout.- Disables all contexts
- Waits for all sessions to drain
- Stops all contexts
- Specified by:
stopin interfaceModClusterServiceMBean- Parameters:
timeout- number of units of time for which to wait for sessions to drain. Negative or zero timeout value will wait forever.unit- unit of time represented in timeout parameter- Returns:
- true, if all contexts stopped successfully, false if sessions fail to drain before specified timeout.
-
stopContext
Description copied from interface:ModClusterServiceMBeanAttempts to gracefully stops a single web application, within the specified timeout.- Disables the specified context
- Waits for all sessions for the specified context to drain
- Stops the specified context
- Specified by:
stopContextin interfaceModClusterServiceMBeantimeout- number of units of time for which to wait for sessions to drain. Negative or zero timeout value will wait forever.unit- unit of time represented in timeout parameter- Returns:
- true, if the specified context was stopped successfully, false if sessions fail to drain before specified timeout.
-