

Public Member Functions | |
| ComponentInfo | activate_component (int componentHandle, long execution_id, String compName, String exe, String type) throws CannotActivateComponentEx |
| void | set_component_shutdown_order (int[] handleSeq) |
| void | deactivate_components (int[] handles) throws CannotDeactivateComponentEx |
| org.omg.CORBA.Object | restart_component (int compHandle) throws CannotRestartComponentEx |
| void | shutdown (int encryptedAction) |
| ComponentInfo[] | get_component_info (int[] handles) |
| String | name () |
| void | disconnect () |
| AuthenticationData | authenticate (long execution_id, String question) |
| void | message (short type, String message) |
| void | taggedmessage (short type, short messageID, String message) |
| boolean | ping () |
| void | components_available (ComponentInfo[] components) |
| void | components_unavailable (String[] component_names) |
| LogLevels | get_default_logLevels () |
| void | set_default_logLevels (LogLevels levels) throws IllegalArgumentEx |
| String[] | get_logger_names () |
| LogLevels | get_logLevels (String logger_name) throws LoggerDoesNotExistEx |
| void | set_logLevels (String logger_name, LogLevels levels) throws LoggerDoesNotExistEx, IllegalArgumentEx |
| void | refresh_logging_config () |
Static Public Attributes | |
| static final int | CONTAINER_RELOAD = 0 |
| static final int | CONTAINER_REBOOT = 1 |
| static final int | CONTAINER_EXIT = 2 |
Protected Member Functions | |
| void | loginToManager () throws AcsJContainerEx |
Package Functions | |
| AcsContainer (String containerName, AcsCorba acsCorba, AcsManagerProxy managerProxy, boolean isEmbedded) throws AcsJContainerEx | |
| void | initialize () throws AcsJContainerEx |
| DAL | getCDB () |
| void | setRecoveryMode (boolean recoveryStart) |
| void | shutdown (int encryptedAction, boolean gracefully, boolean isOrbThread) |
Private Member Functions | |
| void | registerWithCorba () throws AcsJContainerEx |
| ComponentAdapter | getExistingComponent (int componentHandle, String name, String type) |
| ComponentHelper | createComponentHelper (String compName, String exe, ClassLoader compCL) throws AcsJContainerEx |
| synchronized ComponentAdapter[] | markAndFilterForDeactivation (ComponentAdapter[] compAdapters) |
| synchronized void | abortAllComponents (long maxWaitTimeMillis) |
| void | logManagerRequest (String msgBegin, int[] handles) |
Private Attributes | |
| final long | startTimeUTClong |
| final String | m_containerName |
| long | executionId = -1 |
| final AcsManagerProxy | m_managerProxy |
| final AcsCorba | m_acsCorba |
| final boolean | isEmbedded |
| final AcsLogger | m_logger |
| final ThreadFactory | containerThreadFactory |
| final ComponentMap | m_activeComponentMap |
| final CountDownLatch | containerStartOrbThreadGate |
| LogConfig | logConfig |
| DAL | cdb |
| final AtomicBoolean | shuttingDown = new AtomicBoolean(false) |
| boolean | useRecoveryMode = true |
Static Private Attributes | |
| static AcsContainer | s_instance |
The main container class that interfaces with the maci manager. By extending ContainerPOA, an instance of this class is a corba object that implements the maci container interface.
Only one instance of this class can be created per JVM.
| alma::acs::container::AcsContainer::AcsContainer | ( | String | containerName, | |
| AcsCorba | acsCorba, | |||
| AcsManagerProxy | managerProxy, | |||
| boolean | isEmbedded | |||
| ) | throws AcsJContainerEx [inline, package] |
Constructor which creates a container that is registered as a CORBA object, but not yet logged in to the manager (for that, call initialize().
| containerName | ||
| acsCorba | ||
| managerProxy | ||
| isEmbedded | true if this container runs within an application. Affects shutdown behavior. |
| AcsJContainerEx | if anything goes wrong, or if another instance of this class has already been created. |
References containerStartOrbThreadGate, containerThreadFactory, isEmbedded, m_acsCorba, m_activeComponentMap, m_containerName, m_logger, m_managerProxy, registerWithCorba(), s_instance, alma::JavaContainerError::wrappers::AcsJContainerEx::setContextInfo(), and startTimeUTClong.
| synchronized void alma::acs::container::AcsContainer::abortAllComponents | ( | long | maxWaitTimeMillis | ) | [inline, private] |
Aborts all components that are not already aborting or already defunct.
This method runs the components' aboutToAbort methods concurrently in separate daemon threads. It returns when all components have been aborted, or when the abortion is timed out after maxWaitTimeMillis.
| maxWaitTimeMillis | maximum time in milliseconds spent in aboutToAbort of all components. |
References alma::ACS::ComponentStates::COMPSTATE_ABORTING, alma::ACS::ComponentStates::COMPSTATE_DEFUNCT, alma::acs::container::ComponentAdapter::getComponentAbortionist(), alma::acs::container::ComponentAdapter::getComponentStateManager(), alma::acs::container::ComponentStateManagerImpl::getCurrentState(), and alma::acs::container::ComponentAdapter::getName().
| ComponentInfo alma::acs::container::AcsContainer::activate_component | ( | int | componentHandle, | |
| long | execution_id, | |||
| String | compName, | |||
| String | exe, | |||
| String | type | |||
| ) | throws CannotActivateComponentEx [inline] |
Activates a component so that it's ready to receive functional calls after returning from this method. Called by the ACS Manager.
From MACI IDL: Activate a component whose type (class) and name (instance) are given. In the process of activation, component's code-base is loaded into memory if it is not there already. The code-base resides in an executable file (usually a dynamic-link library or a shared library -- DLL). On platforms that do not automatically load dependent executables (e.g., VxWorks), the container identifies the dependencies by querying the executable and loads them automatically. Once the code is loaded, it is asked to construct a servant of a given type. The servant is then initialized with the Configuration Database (CDB) and Persistance Database (PDB) data. The servant is attached to the component, and a reference to it is returned.
| componentHandle | handle of the component that is being activated. This handle is used by the component when it will present itself to the Manager. The component is expected to remember this handle for its entire life-time. | |
| execution_id | ||
| compName | name of the component to instantiate (instance name, comes from CDB) | |
| exe | component helper implementation class; must be a subclass of alma.acs.container.ComponentHelper. | |
| type | the type of the component to instantiate (Corba IR id). |
References alma::acs::container::ComponentAdapter::activateComponent(), containerStartOrbThreadGate, createComponentHelper(), alma::acs::container::ComponentAdapter::deactivateComponent(), alma::acs::container::ComponentAdapter::executeComponent(), alma::acs::container::ComponentHelper::getComponentImpl(), alma::acs::container::ComponentAdapter::getComponentInfo(), alma::acs::container::ComponentHelper::getComponentMethodsExcludedFromInvocationLogging(), getExistingComponent(), alma::acs::container::ComponentHelper::getInterfaceTranslator(), alma::acs::util::StopWatch::getLapTimeMillis(), alma::acs::container::ComponentHelper::getOperationsInterface(), alma::acs::container::ComponentHelper::getPOATieClass(), alma::acs::exceptions::AcsJException::getProperty(), alma::acs::container::ComponentAdapter::initializeComponent(), alma::acs::logging::AcsLogger::log(), m_acsCorba, m_activeComponentMap, m_containerName, m_logger, m_managerProxy, alma::acs::container::ComponentMap::put(), alma::acs::container::ComponentMap::remove(), alma::acs::container::ComponentHelper::requiresOrbCentralLogSuppression(), alma::acs::container::ComponentMap::reserveComponent(), alma::JavaContainerError::wrappers::AcsJContainerEx::setContextInfo(), alma::maciErrType::wrappers::AcsJCannotActivateComponentEx::setCURL(), alma::maciErrType::wrappers::AcsJCannotActivateComponentEx::setDetailedReason(), alma::acs::container::ComponentAdapter::setMethodsExcludedFromInvocationLogging(), shuttingDown, and alma::maciErrType::wrappers::AcsJCannotActivateComponentEx::toCannotActivateComponentEx().
| AuthenticationData alma::acs::container::AcsContainer::authenticate | ( | long | execution_id, | |
| String | question | |||
| ) | [inline] |
Authentication method. Below some passages from maci.idl:
Method authenticate is the challenge issued to the client after it tries to login. The login will be successful if the client's authenticate() produces the expected result. Only in this case will the Manager's login method return a valid handle, which the client will later use as the id parameter with all calls to the Manager.
The first character of the answer identifies the type of the client, and can be one of:
C A regular client (implements just the Client interface). A A container (implements the Container interface). AR A container with recovery capability (implements the Container interface). S Supervisor (implements the Administrator interface). Container may support recovery. If the container terminates unexpectedly, and then recovers (after a reboot, for example), it logs in to the Manager and notifies it that it supports recovery by responding with "AR" to the Client::authenticate method. The Manager then uses the activate_component method on the container to bring all the components the container used to have back to life.
| void alma::acs::container::AcsContainer::components_available | ( | ComponentInfo[] | components | ) | [inline] |
Notify client about the change (availability) of the components currently in use by this client.
| void alma::acs::container::AcsContainer::components_unavailable | ( | String[] | component_names | ) | [inline] |
Notify client that some of the components currently in use by client have become unavailable.
| ComponentHelper alma::acs::container::AcsContainer::createComponentHelper | ( | String | compName, | |
| String | exe, | |||
| ClassLoader | compCL | |||
| ) | throws AcsJContainerEx [inline, private] |
References m_logger, and alma::JavaContainerError::wrappers::AcsJContainerEx::setContextInfo().
Referenced by activate_component().
| void alma::acs::container::AcsContainer::deactivate_components | ( | int[] | handles | ) | throws CannotDeactivateComponentEx [inline] |
Deactivates all components whose handles are given.
From maci.idl: Deactivation is the inverse process of activation: component is detached from the POA, and thus made unavailable through CORBA, and its resources are freed. If its code-base is no longer used, it is unloaded from memory.
| handles | a sequence of handles identifying components that are to be released. If null, then all active components will be deactivated! |
Implements si::ijs::maci::ContainerOperations.
References alma::acs::container::ComponentAdapter::deactivateComponent(), alma::acs::container::ComponentAdapter::getHandle(), alma::acs::container::ComponentAdapter::getName(), and alma::maciErrType::wrappers::AcsJCannotDeactivateComponentEx::toCannotDeactivateComponentEx().
Referenced by getExistingComponent().
| void alma::acs::container::AcsContainer::disconnect | ( | ) | [inline] |
Disconnect notification. The disconnect method is called by the Manager to notify the client that it will be unavailable and that the client should log off.
Since ACS 7.0.2, this method returns quickly and uses a different thread to log back in with the manager. This is cleaner than taking a thread from the ORB's pool for a possibly long time, although the manager does not care because this method is defined as oneway in IDL.
Implements si::ijs::maci::ClientOperations.
| ComponentInfo [] alma::acs::container::AcsContainer::get_component_info | ( | int[] | handles | ) | [inline] |
Returns information about a subset of components that are currently hosted by the Container. Note: If the list of handles is empty, information about all components hosted by the container is returned!
| handles |
Implements si::ijs::maci::ContainerOperations.
References alma::acs::container::ComponentAdapter::getComponentInfo().
| LogLevels alma::acs::container::AcsContainer::get_default_logLevels | ( | ) | [inline] |
Gets the log levels of the default logging configuration. These levels are used by all loggers that have not been configured individually.
Implements si::ijs::maci::LoggingConfigurableOperations.
References si::ijs::maci::LoggingConfigurablePackage::LogLevels::minLogLevel, si::ijs::maci::LoggingConfigurablePackage::LogLevels::minLogLevelLocal, and si::ijs::maci::LoggingConfigurablePackage::LogLevels::useDefault.
| String [] alma::acs::container::AcsContainer::get_logger_names | ( | ) | [inline] |
Gets the names of all loggers, to allow configuring their levels individually. The names are those that appear in the log records in the field "SourceObject". This includes the container logger, ORB logger, component loggers, and (only C++) GlobalLogger.
The returned logger names are randomly ordered.
Implements si::ijs::maci::LoggingConfigurableOperations.
| LogLevels alma::acs::container::AcsContainer::get_logLevels | ( | String | logger_name | ) | throws LoggerDoesNotExistEx [inline] |
Gets log levels for a particular named logger. If the returned field LogLevels.useDefault is true, then the logger uses the default levels, see get_default_logLevels(); otherwise the returned local and remote levels apply.
For possible convenience, the default levels are returned in addition to setting LogLevels#useDefault to true.
| DAL alma::acs::container::AcsContainer::getCDB | ( | ) | [inline, package] |
Gets a reference to the CDB. Reuses the previously obtained reference. Implemented as on-demand remote call, so always use this method instead of directly accessing the field cdb.
: reuse this CDB reference in ContainerServicesImpl for method getCDB()
: Perhaps register for change notification at DAL#add_change_listener(com.cosylab.CDB.DALChangeListener). (Currently Alma does not use live CDB updates, but the feature is there...)
null if it could not be obtained. References cdb, alma::acs::container::AcsManagerProxy::get_service(), alma::acs::logging::AcsLogger::log(), m_logger, and m_managerProxy.
Referenced by initialize().
| ComponentAdapter alma::acs::container::AcsContainer::getExistingComponent | ( | int | componentHandle, | |
| String | name, | |||
| String | type | |||
| ) | [inline, private] |
Checks if there is an existing component that matches the spec. This can happen if the Manager went down and back up. Strategy:
null. | componentHandle | ||
| name | ||
| type |
null if none exists. References deactivate_components(), alma::acs::container::ComponentMap::get(), alma::acs::container::ComponentMap::getComponentByNameAndType(), alma::acs::container::ComponentAdapter::getHandle(), alma::acs::container::ComponentAdapter::getName(), alma::acs::container::ComponentAdapter::getType(), alma::acs::logging::AcsLogger::log(), m_activeComponentMap, and m_logger.
Referenced by activate_component().
| void alma::acs::container::AcsContainer::initialize | ( | ) | throws AcsJContainerEx [inline, package] |
Container initialization such as logging in to the manager, configuring logging, initializing the alarm system. This is taken out of the ctor just to keep is lean and be able to instantiate a minimum container for testing.
| AcsJContainerServicesEx |
References containerStartOrbThreadGate, containerThreadFactory, alma::acs::container::corba::AcsCorba::createPOAForComponent(), com::cosylab::CDB::DALOperations::get_DAO_Servant(), getCDB(), alma::acs::logging::config::LogConfig::initialize(), alma::acs::logging::AcsLogger::log(), logConfig, loginToManager(), m_acsCorba, m_containerName, m_logger, m_managerProxy, name(), alma::acs::logging::config::LogConfig::setCDB(), alma::acs::logging::config::LogConfig::setCDBLoggingConfigPath(), alma::JavaContainerError::wrappers::AcsJContainerEx::setContextInfo(), and alma::acs::container::corba::AcsCorba::setORBLevelRoundtripTimeout().
Referenced by alma::acs::container::AcsEmbeddedContainerRunner::run().
| void alma::acs::container::AcsContainer::loginToManager | ( | ) | throws AcsJContainerEx [inline, protected] |
Will attempt to log into the manager. If the manager reference is not available, will enter a loop and keep trying. If login fails on an available manager, will throw a AcsJContainerServicesEx.
| AcsJContainerServicesEx |
References alma::acs::container::corba::AcsCorba::getContainerCorbaRef(), alma::acs::container::AcsManagerProxy::loginToManager(), m_acsCorba, and m_managerProxy.
Referenced by initialize().
| void alma::acs::container::AcsContainer::logManagerRequest | ( | String | msgBegin, | |
| int[] | handles | |||
| ) | [inline, private] |
Logs a request from the manager which involves an array of component handles. (which is quite different from a LogManager request...)
Checks if the handles are valid. If no component can be found for a given handle, the string (unknown) is appended to that handle.
Used simply to avoid code duplication.
| msgBegin | begin of the log message | |
| handles | handles to components that this container should know of |
| synchronized ComponentAdapter [] alma::acs::container::AcsContainer::markAndFilterForDeactivation | ( | ComponentAdapter[] | compAdapters | ) | [inline, private] |
Filters out those components from compAdapters which can be deactivated (not DESTROYING | ABORTING | DEFUNCT).
Must be synchronized to avoid deactivating the same component more than once.
| compAdapters |
References alma::ACS::ComponentStates::COMPSTATE_ABORTING, alma::ACS::ComponentStates::COMPSTATE_DEFUNCT, alma::ACS::ComponentStates::COMPSTATE_DESTROYING, alma::acs::container::ComponentAdapter::getComponentStateManager(), alma::acs::container::ComponentStateManagerImpl::getCurrentState(), alma::acs::container::ComponentAdapter::getName(), and alma::acs::container::ComponentStateManagerImpl::setStateByContainer().
| void alma::acs::container::AcsContainer::message | ( | short | type, | |
| String | message | |||
| ) | [inline] |
| String alma::acs::container::AcsContainer::name | ( | ) | [inline] |
Implements si::ijs::maci::ClientOperations.
Referenced by initialize().
| boolean alma::acs::container::AcsContainer::ping | ( | ) | [inline] |
Replies with true so that Manager sees that this container is alive.
Prints a message to System.out, so that it's visible on the local console that the container is doing ok. Does not log anything, because a failure to reply would show up remotely anyway.
No message is printed if the container log level is above INFO, see http://jira.alma.cl/browse/COMP-1736.
Implements si::ijs::maci::ClientOperations.
| void alma::acs::container::AcsContainer::refresh_logging_config | ( | ) | [inline] |
Commands the container or manager to read in again the logging configuration from the CDB and to reconfigure the loggers accordingly. This allows for persistent changes in the logging configuration to become effective, and also for changes of more advanced parameters.
Note that unlike for the logging initialization in initialize(), now we give precedence to the CDB values over any previous settings.
Implements si::ijs::maci::LoggingConfigurableOperations.
| void alma::acs::container::AcsContainer::registerWithCorba | ( | ) | throws AcsJContainerEx [inline, private] |
To be called only once from the ctor.
| AcsJContainerEx |
References alma::acs::container::corba::AcsCorba::activateContainer(), m_acsCorba, m_containerName, m_logger, and alma::JavaContainerError::wrappers::AcsJContainerEx::setContextInfo().
Referenced by AcsContainer().
| org.omg.CORBA.Object alma::acs::container::AcsContainer::restart_component | ( | int | compHandle | ) | throws CannotRestartComponentEx [inline] |
Not yet implemented. Left for ACS 3.1 (or later...), see comments at http://almasw.hq.eso.org/almasw/bin/view/ACS/NewMaciIdl, e.g. GianlucaChiozzi - 21 Oct 2003 We do not have really clear ideas yet about this. I think that the most accepted ipothesis is that restart of a component means destroy/create while restart of a container means shutdown/restart. For ACS 3.0 I would forget about this issue and leave it for ACS 3.1.
from maci idl: Restarts a component. Returns a new reference of the restarted component.
| compHandle | Handle of the component to be restarted. |
Implements si::ijs::maci::ContainerOperations.
References alma::acs::container::ComponentAdapter::getName(), alma::maciErrType::wrappers::AcsJCannotRestartComponentEx::setCURL(), and alma::maciErrType::wrappers::AcsJCannotRestartComponentEx::toCannotRestartComponentEx().
| void alma::acs::container::AcsContainer::set_component_shutdown_order | ( | int[] | handleSeq | ) | [inline] |
Called by the manager to update the container's knowledge about optimum shutdown order of its components. This information will only be needed for a locally initiated container shutdown, since the manager will call deactivate_components(int[]) in a regular shutdown.
Implements si::ijs::maci::ContainerOperations.
| void alma::acs::container::AcsContainer::set_default_logLevels | ( | LogLevels | levels | ) | throws IllegalArgumentEx [inline] |
Sets the log levels of the default logging configuration. These levels are used by all loggers that have not been configured individually.
References alma::ACSErrTypeCommon::wrappers::AcsJIllegalArgumentEx::toIllegalArgumentEx().
| void alma::acs::container::AcsContainer::set_logLevels | ( | String | logger_name, | |
| LogLevels | levels | |||
| ) | throws LoggerDoesNotExistEx, IllegalArgumentEx [inline] |
Sets log levels for a particular named logger. If levels.useDefault is true, then the logger will be reset to using default levels; otherwise it will use the supplied local and remote levels.
References alma::ACSErrTypeCommon::wrappers::AcsJIllegalArgumentEx::toIllegalArgumentEx().
| void alma::acs::container::AcsContainer::setRecoveryMode | ( | boolean | recoveryStart | ) | [inline, package] |
References useRecoveryMode.
Referenced by alma::acs::container::AcsEmbeddedContainerRunner::createContainer().
| void alma::acs::container::AcsContainer::shutdown | ( | int | encryptedAction, | |
| boolean | gracefully, | |||
| boolean | isOrbThread | |||
| ) | [inline, package] |
Shuts down the container.
Depending on the gracefully parameter, either deactivate_components(int[]) or abortAllComponents(long) is called.
This method may be called from the following threads:
| encryptedAction | ignored for the time being (always EXIT) | |
| gracefully | if true, this method only returns after cleanUp has been called on all components. if false, it returns faster, running the components' abort methods in separate threads for at most 3 seconds. |
| void alma::acs::container::AcsContainer::shutdown | ( | int | encryptedAction | ) | [inline] |
Action to take after shutting down (ignored for the time being). Bits 8 thru 15 of this parameter denote the action, which can be one of:
The bits 0 thru 7 (values 0 to 255) are the return value that the Container should pass to the operating system. TODO: get rid of this silly bit-multiplexing
Implements si::ijs::maci::ContainerOperations.
Referenced by alma::acs::container::ShutdownHook::interruptDetected(), and alma::acs::commandcenter::engine::ExecuteContainer::stopLocalJava().
| void alma::acs::container::AcsContainer::taggedmessage | ( | short | type, | |
| short | messageID, | |||
| String | message | |||
| ) | [inline] |
DAL alma::acs::container::AcsContainer::cdb [private] |
final int alma::acs::container::AcsContainer::CONTAINER_EXIT = 2 [static] |
final int alma::acs::container::AcsContainer::CONTAINER_REBOOT = 1 [static] |
final int alma::acs::container::AcsContainer::CONTAINER_RELOAD = 0 [static] |
actions for shutdown()
final CountDownLatch alma::acs::container::AcsContainer::containerStartOrbThreadGate [private] |
Gate that blocks some (currently: only activate_component) incoming calls while the container is initializing itself and therefore not fully ready. In particular, this will be used to hold component activation requests for autostart components, which the manager sends right after the container has logged in to the manager.
Referenced by AcsContainer(), activate_component(), and initialize().
final ThreadFactory alma::acs::container::AcsContainer::containerThreadFactory [private] |
Referenced by AcsContainer(), and initialize().
long alma::acs::container::AcsContainer::executionId = -1 [private] |
An ID assigned by the manager at first login. This ID survives logout/login to the manager. For container shutdown/crashes, a new ID is assigned the following login.
final boolean alma::acs::container::AcsContainer::isEmbedded [private] |
Referenced by AcsContainer().
Singleton logging config object shared with ClientLogManager.
Referenced by initialize().
final AcsCorba alma::acs::container::AcsContainer::m_acsCorba [private] |
Referenced by AcsContainer(), activate_component(), initialize(), loginToManager(), and registerWithCorba().
final ComponentMap alma::acs::container::AcsContainer::m_activeComponentMap [private] |
Referenced by AcsContainer(), activate_component(), and getExistingComponent().
final String alma::acs::container::AcsContainer::m_containerName [private] |
Referenced by AcsContainer(), activate_component(), initialize(), and registerWithCorba().
final AcsLogger alma::acs::container::AcsContainer::m_logger [private] |
Referenced by AcsContainer(), activate_component(), createComponentHelper(), getCDB(), getExistingComponent(), initialize(), and registerWithCorba().
final AcsManagerProxy alma::acs::container::AcsContainer::m_managerProxy [private] |
Referenced by AcsContainer(), activate_component(), getCDB(), initialize(), and loginToManager().
AcsContainer alma::acs::container::AcsContainer::s_instance [static, private] |
It's a singleton, but not with a static getAcsContainer() method to restrict access; s_instance is needed to enforce single instantiation.
Referenced by AcsContainer().
final AtomicBoolean alma::acs::container::AcsContainer::shuttingDown = new AtomicBoolean(false) [private] |
Referenced by activate_component().
final long alma::acs::container::AcsContainer::startTimeUTClong [private] |
Start time, used during login to the manager.
Referenced by AcsContainer().
boolean alma::acs::container::AcsContainer::useRecoveryMode = true [private] |
see comments in authenticate(String)
Referenced by setRecoveryMode().
1.6.2