
Public Member Functions | |
| AcsDoActivity (String name, AcsSimpleState nextState, AcsSimpleState errorState, AcsLogger logger, ThreadPoolExecutor executor) | |
| void | execute () |
| abstract void | runActions () throws AcsStateActionException |
| void | terminateActions () |
Package Functions | |
| void | logActionFailure (String sourceStateName, String targetStateName, String actionName, Throwable thr) |
Private Attributes | |
| final AcsSimpleState | m_nextState |
| final AcsSimpleState | m_errorState |
| final String | m_name |
| final AcsLogger | logger |
| final ThreadPoolExecutor | executor |
| volatile boolean | m_completed |
Represents an Activity in state (do-activity).
Implementation note: uses a single instance of ExecutorService for cheaply reusing a thread in execute() for all do activities.
| alma::acs::genfw::runtime::sm::AcsDoActivity::AcsDoActivity | ( | String | name, | |
| AcsSimpleState | nextState, | |||
| AcsSimpleState | errorState, | |||
| AcsLogger | logger, | |||
| ThreadPoolExecutor | executor | |||
| ) | [inline] |
| name | name for the activity | |
| nextState | state to which the implicit "completion transition" will go. | |
| errorState | error state to which we'll go in case of errors. | |
| logger | Logger used by this class. | |
| threadFactory | The thread factory used for asynchronous execution of the runActions() method. |
References m_completed, m_errorState, m_name, and m_nextState.
| void alma::acs::genfw::runtime::sm::AcsDoActivity::execute | ( | ) | [inline] |
Runs runActions() in a separate thread and returns immediately. When the actions are completed, a transition to the next state is triggered, as specified in the constructor.
References alma::acs::genfw::runtime::sm::AcsSimpleState::activate(), executor, alma::acs::logging::AcsLogger::log(), logger, m_completed, m_errorState, m_name, m_nextState, and runActions().
Referenced by alma::ACS::MasterComponentImpl::statemachine::ShuttingdownPass2State::entry(), alma::ACS::MasterComponentImpl::statemachine::ShuttingdownPass1State::entry(), alma::ACS::MasterComponentImpl::statemachine::ReinitializingState::entry(), alma::ACS::MasterComponentImpl::statemachine::InitializingPass2State::entry(), and alma::ACS::MasterComponentImpl::statemachine::InitializingPass1State::entry().
| void alma::acs::genfw::runtime::sm::AcsDoActivity::logActionFailure | ( | String | sourceStateName, | |
| String | targetStateName, | |||
| String | actionName, | |||
| Throwable | thr | |||
| ) | [inline, package] |
| sourceStateName | beginning of transition, or activity state | |
| targetStateName | end of transition, or null if the action comes from the do/ method of an activity state. | |
| actionName |
References alma::acs::logging::AcsLogger::log(), and logger.
| abstract void alma::acs::genfw::runtime::sm::AcsDoActivity::runActions | ( | ) | throws AcsStateActionException [pure virtual] |
Must call the action methods associated with this activity.
Referenced by execute().
| void alma::acs::genfw::runtime::sm::AcsDoActivity::terminateActions | ( | ) | [inline] |
Terminates the actions if they are still running.
References executor, logger, m_completed, and m_name.
Referenced by alma::ACS::MasterComponentImpl::statemachine::ShuttingdownPass2State::exit(), alma::ACS::MasterComponentImpl::statemachine::ShuttingdownPass1State::exit(), alma::ACS::MasterComponentImpl::statemachine::ReinitializingState::exit(), alma::ACS::MasterComponentImpl::statemachine::InitializingPass2State::exit(), and alma::ACS::MasterComponentImpl::statemachine::InitializingPass1State::exit().
final ThreadPoolExecutor alma::acs::genfw::runtime::sm::AcsDoActivity::executor [private] |
not actually used as a queue, but simply to wrap and reuse a Thread, since only one do-action method is supposed to run at a time in a non-concurrent state machine. todo: or maybe it's a queue, if a composite (super) state also has a /do method ?
Referenced by execute(), and terminateActions().
final AcsLogger alma::acs::genfw::runtime::sm::AcsDoActivity::logger [private] |
Referenced by execute(), logActionFailure(), and terminateActions().
volatile boolean alma::acs::genfw::runtime::sm::AcsDoActivity::m_completed [private] |
Referenced by AcsDoActivity(), execute(), and terminateActions().
Referenced by AcsDoActivity(), and execute().
final String alma::acs::genfw::runtime::sm::AcsDoActivity::m_name [private] |
Referenced by AcsDoActivity(), execute(), and terminateActions().
Referenced by AcsDoActivity(), and execute().
1.6.2