Classes | |
class | DefaultResourceErrorHandler< T > |
class | StateChangeNotificationChecker |
Public Member Functions | |
void | initialize (ContainerServices containerServices) throws ComponentLifecycleException |
void | cleanUp () throws AcsJComponentCleanUpEx |
final ROstringSeq | currentStateHierarchy () |
final synchronized void | doTransition (SubsystemStateEvent event) throws IllegalStateEventEx |
void | stateChangedNotify (AcsState[] oldStateHierarchy, AcsState[] currentStateHierarchy) |
void | updateStateHierarchy () throws AcsJException |
Protected Member Functions | |
abstract AlmaSubsystemActions | getActionHandler () |
final void | monitorComponent (ACSComponent component) |
final< T extends ACSComponent > void | monitorComponent (T component, SubsysResourceMonitor.ResourceErrorHandler< T > err) |
final void | monitorPingableResource (PingableResourceOperations resource, String name) |
final< T extends PingableResourceOperations > void | monitorPingableResource (T resource, String name, SubsysResourceMonitor.ResourceErrorHandler< T > err) |
final< T > void | monitorResource (SubsysResourceMonitor.ResourceChecker< T > checker, SubsysResourceMonitor.ResourceErrorHandler< T > err, int monitorDelaySeconds) |
final void | stopMonitoringResource (String resourceName) |
final void | stopMonitoringAllResources () |
Static Package Functions | |
static String | event2Name (SubsystemStateEvent event) |
Base class for subsystem master components.
Each ALMA subsystem ('subsystem' in its technical meaning) must provide such a master component for administrational purposes. It's strongly recommended to do this in Java and use MasterComponentImplBase
as the base class for the component implementation.
This class provides the transition logic for the various states. Subclasses only need to implement the actions for the various transitions or, more accurately, for the activity states. (see method getActionHandler; as an example, please see TestMasterComponent.
void alma.ACS.MasterComponentImpl.MasterComponentImplBase.cleanUp | ( | ) | throws AcsJComponentCleanUpEx |
Master component subclasses must call super.cleanUp()
if they override this method!
References alma.ACS.MasterComponentImpl.statemachine.AlmaSubsystemContext.cleanUp(), alma.ACS.MasterComponentImpl.SubsysResourceMonitor.destroy(), and alma.acs.component.ComponentImplBase.m_logger.
final ROstringSeq alma.ACS.MasterComponentImpl.MasterComponentImplBase.currentStateHierarchy | ( | ) |
final synchronized void alma.ACS.MasterComponentImpl.MasterComponentImplBase.doTransition | ( | SubsystemStateEvent | event | ) | throws IllegalStateEventEx |
Dispatches the event to the corresponding state machine method.
Relies on CORBA to queue concurrent calls, which this synchronized implementation forcefully serializes. Note that calls should always return quickly, since the real work is done asynchronously in activity states.
References alma.ACS.MasterComponentImpl.statemachine.AlmaSubsystemContext.error(), alma.ACS.MasterComponentImpl.MasterComponentImplBase.event2Name(), alma.ACS.MasterComponentImpl.statemachine.AlmaSubsystemContext.initPass1(), alma.ACS.MasterComponentImpl.statemachine.AlmaSubsystemContext.initPass2(), alma.acs.component.ComponentImplBase.m_logger, alma.ACS.MasterComponentImpl.statemachine.AlmaSubsystemContext.reinit(), alma.ACS.MasterComponentImpl.statemachine.AlmaSubsystemContext.shutdownPass1(), alma.ACS.MasterComponentImpl.statemachine.AlmaSubsystemContext.shutdownPass2(), alma.ACS.MasterComponentImpl.statemachine.AlmaSubsystemContext.start(), and alma.ACS.MasterComponentImpl.statemachine.AlmaSubsystemContext.stop().
Referenced by alma.ACS.MasterComponentImpl.MasterComponentImplBase.DefaultResourceErrorHandler< T >.badState(), and alma.ACS.MasterComponentImpl.MasterComponentImplBase.DefaultResourceErrorHandler< T >.resourceUnreachable().
static String alma.ACS.MasterComponentImpl.MasterComponentImplBase.event2Name | ( | SubsystemStateEvent | event | ) | [static, package] |
Returns an "inofficial" string version of a SubsystemStateEvent
. This can be used for logging etc. Note that in IDL, the enum does not define a string representation.
event | a subsystem state event as declared in IDL |
null
if the event is unknown. Referenced by alma.ACS.MasterComponentImpl.MasterComponentImplBase.doTransition().
abstract AlmaSubsystemActions alma.ACS.MasterComponentImpl.MasterComponentImplBase.getActionHandler | ( | ) | [protected, pure virtual] |
Subsystem state machine actions, to be implemented by concrete subclasses.
Referenced by alma.ACS.MasterComponentImpl.MasterComponentImplBase.initialize().
void alma.ACS.MasterComponentImpl.MasterComponentImplBase.initialize | ( | ContainerServices | containerServices | ) | throws ComponentLifecycleException |
Master component subclasses must call super.initialize()
if they override this method!
References alma.ACS.MasterComponentImpl.statemachine.AlmaSubsystemContext.addAcsStateChangeListener(), alma.ACS.MasterComponentImpl.MasterComponentImplBase.getActionHandler(), alma.ACS.impl.CommonPropertyImpl.getDataAccess(), alma.acs.container.ContainerServicesBase.getThreadFactory(), alma.acs.component.ComponentImplBase.m_containerServices, alma.acs.component.ComponentImplBase.m_logger, alma.acs.component.ComponentImplBase.name(), alma.ACS.impl.CharacteristicComponentImpl.registerProperty(), and alma.ACS.MasterComponentImpl.MasterComponentImplBase.updateStateHierarchy().
final void alma.ACS.MasterComponentImpl.MasterComponentImplBase.monitorComponent | ( | ACSComponent | component | ) | [protected] |
Subclasses can request to have the "health" of a given subsystem component monitored, and that the mastercomponent state be set to "Error" in case problems are detected with this component. It is then the responsibility of the operator or some other external actor to get the mastercomponent out of this error state again. In other words, this method helps to detect problems, but does not fix the problem itself.
Detected problems can be
Note that this is a simplified version of monitorComponent(ACSComponent, ComponentErrorHandler) and does not require the subclass to provide an error handler.
Before a resource gets unloaded/released etc, its monitoring should be stopped to avoid false errors, using stopMonitoringResource(String) or stopMonitoringAllResources().
final<T extends ACSComponent> void alma.ACS.MasterComponentImpl.MasterComponentImplBase.monitorComponent | ( | T | component, | |
SubsysResourceMonitor.ResourceErrorHandler< T > | err | |||
) | [protected] |
Subclasses can request to have the "health" of a given subsystem component monitored, and that the provided ResourceErrorHandler
be called in case problems are detected.
Unlike method monitorComponent(ACSComponent), this method gives full control over the reaction to a detected failure. The master component can thus ignore or try to fix the problem, or eventually also go to error state (by calling doTransition(SubsystemStateEvent.SUBSYSEVENT_ERROR)
).
Before a resource gets unloaded/released etc, its monitoring should be stopped to avoid false errors, using stopMonitoringResource(String) or stopMonitoringAllResources().
component | the component that should be monitored | |
err | a custom error handler. If null , then a default error handler will be used, and the master component will go to error state automatically (same as using monitorComponent(ACSComponent)). |
References alma.ACS.MasterComponentImpl.MasterComponentImplBase.monitorResource().
final void alma.ACS.MasterComponentImpl.MasterComponentImplBase.monitorPingableResource | ( | PingableResourceOperations | resource, | |
String | name | |||
) | [protected] |
Like monitorComponent(ACSComponent) but for objects implementing the PingableResource interface.
resource | the resource that should be monitored |
final<T extends PingableResourceOperations> void alma.ACS.MasterComponentImpl.MasterComponentImplBase.monitorPingableResource | ( | T | resource, | |
String | name, | |||
SubsysResourceMonitor.ResourceErrorHandler< T > | err | |||
) | [protected] |
Like monitorComponent() but for objects implementing the PingableResource interface.
resource | the resource that should be monitored | |
err | a custom error handler. If null , then a default error handler will be used, and the master component will go to error state automatically (same as using monitorPingableResource(PingableResourceOperations)). |
References alma.ACS.MasterComponentImpl.MasterComponentImplBase.monitorResource().
final<T> void alma.ACS.MasterComponentImpl.MasterComponentImplBase.monitorResource | ( | SubsysResourceMonitor.ResourceChecker< T > | checker, | |
SubsysResourceMonitor.ResourceErrorHandler< T > | err, | |||
int | monitorDelaySeconds | |||
) | [protected] |
Subclasses can request to have the "health" of a given subsystem component monitored, and that the provided ResourceErrorHandler
be called in case problems are detected.
Compared with the methods that allow monitoring a component, this method offers more flexibility: any kind of resource can be monitored, for which a custom ResourceChecker
must be provided. Examples of resources include an "offshoot" remote object, a database, or a standalone-process such as Tomcat.
This method also takes the delay between monitor calls as a parameter, to allow adjusting the frequency of monitor calls on a per resource basis. Invalid values will result in the default delay being used.
Before a resource gets unloaded/released etc, its monitoring should be stopped to avoid false errors, using stopMonitoringResource(String) or stopMonitoringAllResources().
checker | The checker that encapsulates the specifics of the methods to be checked. Must not be null . | |
err | A custom error handler. If null , then a default error handler will be used, and the master component will go to error state automatically (see comment for method monitorComponent(ACSComponent). | |
monitorDelaySeconds | The delay between two check calls. If monitorDelaySeconds < 1 then the default delay of 10 seconds will be used. | |
<T> | The resource type. Used to enforce matching checker and error handler. |
References alma.ACS.MasterComponentImpl.SubsysResourceMonitor.monitorResource().
Referenced by alma.ACS.MasterComponentImpl.MasterComponentImplBase.monitorComponent(), and alma.ACS.MasterComponentImpl.MasterComponentImplBase.monitorPingableResource().
void alma.ACS.MasterComponentImpl.MasterComponentImplBase.stateChangedNotify | ( | AcsState[] | oldStateHierarchy, | |
AcsState[] | currentStateHierarchy | |||
) |
Will be called by the state machine implementation for every state change.
Normally you should not overload this method; if you do, make sure to call updateStateHierarchy() so that the state change propagates to the field which is visible from the outside of this component.
Implements alma.acs.genfw.runtime.sm.AcsStateChangeListener.
References alma.acs.component.ComponentImplBase.m_logger, and alma.ACS.MasterComponentImpl.MasterComponentImplBase.updateStateHierarchy().
final void alma.ACS.MasterComponentImpl.MasterComponentImplBase.stopMonitoringAllResources | ( | ) | [protected] |
Stops monitoring all resources that have been previously submitted for monitoring.
References alma.ACS.MasterComponentImpl.SubsysResourceMonitor.stopMonitoringAll().
final void alma.ACS.MasterComponentImpl.MasterComponentImplBase.stopMonitoringResource | ( | String | resourceName | ) | [protected] |
Stops monitoring a resource. It is important to stop monitoring resources before they get released, for example when shutting down.
References alma.ACS.MasterComponentImpl.SubsysResourceMonitor.stopMonitoring().
void alma.ACS.MasterComponentImpl.MasterComponentImplBase.updateStateHierarchy | ( | ) | throws AcsJException |
Sets the property value of currentStateHierarchy
to match the current (sub-)states from the state machine.
This method should not be overloaded by subclasses! We just don't make it final to meet special testing needs.
References alma.acs.exceptions.AcsJCompletion.getAcsJException(), alma.ACS.MasterComponentImpl.statemachine.AlmaSubsystemContext.getCurrentTopLevelState(), alma.acs.exceptions.AcsJCompletion.isError(), alma.acs.component.ComponentImplBase.m_logger, alma.ACS.jbaci.DataAccess.set(), and alma.acs.genfw.runtime.sm.AcsState.stateName().
Referenced by alma.ACS.MasterComponentImpl.MasterComponentImplBase.initialize(), and alma.ACS.MasterComponentImpl.MasterComponentImplBase.stateChangedNotify().