Inherits si::ijs::maci::ContainerPOA.
Public Member Functions | |
ComponentInfo | activate_component (int componentHandle, long execution_id, String compName, String exe, String type) throws CannotActivateComponentEx |
void | activate_component_async (final int h, final long execution_id, final String name, final String exe, final String type, final CBComponentInfo callback, final CBDescIn desc) |
void | set_component_shutdown_order (int[] handleSeq) |
void | deactivate_component (int handle) throws ComponentDeactivationUncleanEx, ComponentDeactivationFailedEx |
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 |
void | tryToWaitForContainerStart () |
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) |
Package Attributes | |
final ThreadPoolExecutor | threadPoolExecutor |
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 [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 alma.acs.container.AcsContainer.threadPoolExecutor.
ComponentInfo alma.acs.container.AcsContainer.activate_component | ( | int | componentHandle, | |
long | execution_id, | |||
String | compName, | |||
String | exe, | |||
String | type | |||
) | throws CannotActivateComponentEx |
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(), alma.acs.container.ComponentAdapter.deactivateComponent(), alma.acs.container.ComponentAdapter.executeComponent(), alma.acs.container.ComponentAdapter.getComponentInfo(), alma.acs.util.StopWatch.getLapTimeMillis(), alma.acs.container.ComponentAdapter.initializeComponent(), alma.acs.logging.AcsLogger.log(), alma.acs.container.ComponentMap.put(), alma.acs.container.ComponentMap.remove(), alma.acs.container.ComponentMap.reserveComponent(), alma.acs.util.StopWatch.reset(), alma.acs.container.ComponentAdapter.setComponentXmlTranslatorProxy(), and alma.acs.container.ComponentAdapter.setMethodsExcludedFromInvocationLogging().
Referenced by alma.acs.container.AcsContainer.activate_component_async().
void alma.acs.container.AcsContainer.activate_component_async | ( | final int | h, | |
final long | execution_id, | |||
final String | name, | |||
final String | exe, | |||
final String | type, | |||
final CBComponentInfo | callback, | |||
final CBDescIn | desc | |||
) |
AuthenticationData alma.acs.container.AcsContainer.authenticate | ( | long | execution_id, | |
String | question | |||
) |
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 | ) |
Notify client about the change (availability) of the components currently in use by this client.
References alma.acs.container.ComponentMap.getAllComponentAdapters().
void alma.acs.container.AcsContainer.components_unavailable | ( | String[] | component_names | ) |
Notify client that some of the components currently in use by client have become unavailable.
References alma.acs.container.ComponentMap.getAllComponentAdapters().
void alma.acs.container.AcsContainer.deactivate_component | ( | int | handle | ) | throws ComponentDeactivationUncleanEx, ComponentDeactivationFailedEx |
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 handle identifying the component that should be released. If handle == 0 , then all active components will be deactivated! |
References alma.acs.container.ComponentMap.getComponentAdapters().
void alma.acs.container.AcsContainer.disconnect | ( | ) |
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.
References alma.acs.logging.AcsLogger.log(), alma.acs.container.AcsContainer.loginToManager(), alma.acs.container.AcsManagerProxy.logoutFromManager(), and alma.acs.container.AcsContainer.shutdown().
ComponentInfo [] alma.acs.container.AcsContainer.get_component_info | ( | int[] | handles | ) |
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 |
References alma.acs.container.ComponentMap.getAllComponentAdapters(), alma.acs.container.ComponentMap.getComponentAdapters(), and alma.acs.container.ComponentAdapter.getComponentInfo().
LogLevels alma.acs.container.AcsContainer.get_default_logLevels | ( | ) |
Gets the log levels of the default logging configuration. These levels are used by all loggers that have not been configured individually.
References alma.acs.logging.config.LogConfig.getDefaultMinLogLevel(), alma.acs.logging.config.LogConfig.getDefaultMinLogLevelLocal(), and alma.acs.container.AcsContainer.tryToWaitForContainerStart().
String [] alma.acs.container.AcsContainer.get_logger_names | ( | ) |
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.
References alma.acs.logging.config.LogConfig.getLoggerNames(), and alma.acs.container.AcsContainer.tryToWaitForContainerStart().
LogLevels alma.acs.container.AcsContainer.get_logLevels | ( | String | logger_name | ) | throws LoggerDoesNotExistEx |
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
.
References alma.acs.logging.config.LogConfig.getNamedLoggerConfig(), alma.acs.logging.config.LogConfig.hasCustomConfig(), and alma.acs.container.AcsContainer.tryToWaitForContainerStart().
DAL alma.acs.container.AcsContainer.getCDB | ( | ) | [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 alma.acs.container.AcsManagerProxy.get_service(), and alma.acs.logging.AcsLogger.log().
Referenced by alma.acs.container.AcsContainer.initialize().
void alma.acs.container.AcsContainer.initialize | ( | ) | throws AcsJContainerEx [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 alma.acs.alarmsystem.source.AlarmSource.clearAlarm(), alma.acs.container.corba.AcsCorba.createPOAForComponent(), alma.acs.container.ContainerServicesImpl.getAlarmSource(), alma.acs.container.AcsContainer.getCDB(), alma.acs.logging.config.LogConfig.initialize(), alma.acs.logging.AcsLogger.log(), alma.acs.container.AcsContainer.loginToManager(), alma.acs.alarmsystem.source.AlarmSource.raiseAlarm(), alma.acs.logging.config.LogConfig.setCDB(), alma.acs.logging.config.LogConfig.setCDBLoggingConfigPath(), and alma.acs.container.corba.AcsCorba.setORBLevelRoundtripTimeout().
Referenced by alma.acs.container.AcsEmbeddedContainerRunner.run().
void alma.acs.container.AcsContainer.loginToManager | ( | ) | throws AcsJContainerEx [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(), and alma.acs.container.AcsManagerProxy.loginToManager().
Referenced by alma.acs.container.AcsContainer.disconnect(), and alma.acs.container.AcsContainer.initialize().
void alma.acs.container.AcsContainer.message | ( | short | type, | |
String | message | |||
) |
String alma.acs.container.AcsContainer.name | ( | ) |
boolean alma.acs.container.AcsContainer.ping | ( | ) |
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.
References alma.acs.logging.config.LogConfig.getNamedLoggerConfig().
void alma.acs.container.AcsContainer.refresh_logging_config | ( | ) |
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.
References alma.acs.logging.config.LogConfig.initialize(), alma.acs.logging.AcsLogger.log(), and alma.acs.container.AcsContainer.tryToWaitForContainerStart().
org.omg.CORBA.Object alma.acs.container.AcsContainer.restart_component | ( | int | compHandle | ) | throws CannotRestartComponentEx |
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. |
References alma.acs.container.ComponentMap.get(), and alma.acs.container.ComponentAdapter.getName().
void alma.acs.container.AcsContainer.set_component_shutdown_order | ( | int[] | handleSeq | ) |
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_component(int) in a regular shutdown.
References alma.acs.container.ComponentMap.sort().
void alma.acs.container.AcsContainer.set_default_logLevels | ( | LogLevels | levels | ) | throws IllegalArgumentEx |
Sets the log levels of the default logging configuration. These levels are used by all loggers that have not been configured individually.
References alma.acs.logging.config.LogConfig.setDefaultMinLogLevel(), alma.acs.logging.config.LogConfig.setDefaultMinLogLevelLocal(), and alma.acs.container.AcsContainer.tryToWaitForContainerStart().
void alma.acs.container.AcsContainer.set_logLevels | ( | String | logger_name, | |
LogLevels | levels | |||
) | throws LoggerDoesNotExistEx, IllegalArgumentEx |
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.acs.logging.config.LogConfig.clearNamedLoggerConfig(), alma.acs.logging.config.LogConfig.setNamedLoggerConfig(), and alma.acs.container.AcsContainer.tryToWaitForContainerStart().
void alma.acs.container.AcsContainer.setRecoveryMode | ( | boolean | recoveryStart | ) | [package] |
void alma.acs.container.AcsContainer.shutdown | ( | int | encryptedAction, | |
boolean | gracefully, | |||
boolean | isOrbThread | |||
) | [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. |
References alma.acs.container.ContainerServicesImpl.cleanUp(), alma.acs.logging.AcsLogger.log(), alma.acs.container.AcsManagerProxy.logoutFromManager(), alma.acs.container.AcsManagerProxy.shutdownNotify(), alma.acs.container.corba.AcsCorba.shutdownORB(), and alma.acs.container.AcsContainer.threadPoolExecutor.
void alma.acs.container.AcsContainer.shutdown | ( | int | encryptedAction | ) |
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
Referenced by alma.acs.container.AcsContainer.disconnect(), alma.acs.container.ShutdownHook.interruptDetected(), and alma.acs.commandcenter.engine.ExecuteContainer.stopLocalJava().
void alma.acs.container.AcsContainer.taggedmessage | ( | short | type, | |
short | messageID, | |||
String | message | |||
) |
void alma.acs.container.AcsContainer.tryToWaitForContainerStart | ( | ) | [protected] |
************************ END LoggingConfigurable ************************ Waits for the container to finish startup, see containerStartOrbThreadGate. Does not expose InterruptedException, so that in case of such an exception this method will return without the container having finished its startup.
Referenced by alma.acs.container.AcsContainer.get_default_logLevels(), alma.acs.container.AcsContainer.get_logger_names(), alma.acs.container.AcsContainer.get_logLevels(), alma.acs.container.AcsContainer.refresh_logging_config(), alma.acs.container.AcsContainer.set_default_logLevels(), and alma.acs.container.AcsContainer.set_logLevels().
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 ThreadPoolExecutor alma.acs.container.AcsContainer.threadPoolExecutor [package] |