com.metamatrix.common.config
Class StartupStateController

java.lang.Object
  extended by com.metamatrix.common.config.StartupStateController

public final class StartupStateController
extends java.lang.Object

This tool, which is to be used only by the com.metamatrix.platform.util.MetaMatrixController during system startup, works with CurrentConfiguration to initialize system state, and also the system configurations, in the configuration database.

All MetaMatrixControllers will call #beginSystemInitialization, in an attempt to be the first one to start system initialization. System startup state ensures that initialization happens exactly once.

The #beginSystemInitialization method will attempt to simultaneously read, then set, the system startup state as a transaction. The state will be set to STATE_STARTING by this method, but only under the following conditions:

If the #beginSystemInitialization method executes without an exception, the client should call #finishSystemInitialization after doing any startup work. This will put the system into a state of STATE_STARTED. MetaMatrixController should only call this method if the #beginSystemInitialization method executed without exception.


Field Summary
static int STATE_STARTED
          This state indicates that either the system is successfully started, or this state also may be stored this way in the database because the system crashed and did not reset it.
static java.lang.String STATE_STARTED_LABEL
          descriptive label for STATE_STARTED state
static int STATE_STARTING
          This state indicates the system is in the process of starting.
static java.lang.String STATE_STARTING_LABEL
          descriptive label for STATE_STARTING state
static int STATE_STOPPED
          This state indicates the system is stopped, and ready to be started.
static java.lang.String STATE_STOPPED_LABEL
          descriptive label for STATE_STOPPED state
 
Constructor Summary
StartupStateController()
           
 
Method Summary
static java.lang.String getStateLabel(int state)
           
static void performSystemInitialization(boolean forceInitialization)
          This method should be called only by com.metamatrix.platform.util.MetaMatrixController to initialize the system configurations during bootstrapping.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

STATE_STOPPED

public static final int STATE_STOPPED
This state indicates the system is stopped, and ready to be started.

See Also:
Constant Field Values

STATE_STOPPED_LABEL

public static final java.lang.String STATE_STOPPED_LABEL
descriptive label for STATE_STOPPED state

See Also:
Constant Field Values

STATE_STARTING

public static final int STATE_STARTING
This state indicates the system is in the process of starting. If a MetaMatrixController encounters this state, it is because another MetaMatrixController is in the process of starting the system. However, this state also may be stored this way in the database because the system crashed and did not reset it. At the discretion of the system administrator, he can choose to force a system start even if the system is in this state, if he believes it is because the system crashed.

See Also:
Constant Field Values

STATE_STARTING_LABEL

public static final java.lang.String STATE_STARTING_LABEL
descriptive label for STATE_STARTING state

See Also:
Constant Field Values

STATE_STARTED

public static final int STATE_STARTED
This state indicates that either the system is successfully started, or this state also may be stored this way in the database because the system crashed and did not reset it. At the discretion of the system administrator, he can choose to force a system start even if the system is in this state, if he believes it is because the system crashed.

See Also:
Constant Field Values

STATE_STARTED_LABEL

public static final java.lang.String STATE_STARTED_LABEL
descriptive label for STATE_STARTED state

See Also:
Constant Field Values
Constructor Detail

StartupStateController

public StartupStateController()
Method Detail

getStateLabel

public static final java.lang.String getStateLabel(int state)

performSystemInitialization

public static final void performSystemInitialization(boolean forceInitialization)
                                              throws StartupStateException,
                                                     ConfigurationException
This method should be called only by com.metamatrix.platform.util.MetaMatrixController to initialize the system configurations during bootstrapping. This method will attempt to put the system state into STATE_STARTING, and then commence with initialization. If the state is already STATE_STARTING, then another MetaMatrixController is already currently in the process of starting the system, and a StartupStateException will be thrown. If this method returns without an exception, then the system state will be in state STATE_STARTING, and the calling code should proceed with startup.

Parameters:
forceInitialization - if the system is in a state other than STATE_STOPPED, and the administrator thinks the system actually crashed and is not really running, he can choose to force the initialization. Otherwise, if the system is in one of these states, an exception will be thrown.
Throws:
StartupStateException - if the system is not in a state in which initialization can proceed. This exception will indicate the current system state.
ConfigurationException - if the current configuration and/or bootstrap properties could not be obtained NOTE: This method replaces the begin... and finish.. SystemInitialization methods for the new configuration implementations.


Copyright © 2009. All Rights Reserved.