public class AcsContainer
extends ContainerPOA
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.
| Modifier and Type | Field and Description |
|---|---|
static int |
CONTAINER_EXIT |
static int |
CONTAINER_REBOOT |
static int |
CONTAINER_RELOAD
actions for shutdown()
|
| Modifier and Type | Method and Description |
|---|---|
void |
activate_component_async(int h,
long execution_id,
java.lang.String name,
java.lang.String exe,
java.lang.String type,
CBComponentInfo callback,
CBDescIn desc) |
ComponentInfo |
activate_component(int componentHandle,
long execution_id,
java.lang.String compName,
java.lang.String exe,
java.lang.String type)
Activates a component so that it's ready to receive functional calls
after returning from this method.
|
AuthenticationData |
authenticate(long execution_id,
java.lang.String question)
Authentication method.
|
void |
components_available(ComponentInfo[] components)
Notify client about the change (availability) of the components currently in use by this client.
|
void |
components_unavailable(java.lang.String[] component_names)
Notify client that some of the components currently in use by client
have become unavailable.
|
void |
deactivate_component(int handle)
Deactivates all components whose handles are given.
|
void |
disconnect()
Disconnect notification.
|
ComponentInfo[] |
get_component_info(int[] handles)
Returns information about a subset of components that are currently hosted by the Container.
|
LogLevels |
get_default_logLevels()
Gets the log levels of the default logging configuration.
|
int |
get_handle() |
java.lang.String[] |
get_logger_names()
Gets the names of all loggers, to allow configuring their levels
individually.
|
LogLevels |
get_logLevels(java.lang.String logger_name)
Gets log levels for a particular named logger.
|
LogStatsInformation |
get_statistics_logger_configuration_byname(java.lang.String logger_name)
Gets the names and status of statistics module of requested logger.
|
LogStatsInformation[] |
get_statistics_logger_configuration()
Gets the names and status of all statistics modules of all loggers, to allow configuring them individually.
|
protected void |
initFromCdb(boolean isContainerStart)
Retrieves the container configuration from the CDB and uses it to initialize the container.
|
protected void |
loginToManager(int attempts)
Will attempt to log into the manager.
|
void |
message(short type,
java.lang.String message) |
java.lang.String |
name() |
boolean |
ping()
Replies with
true so that Manager sees that this container is alive. |
void |
refresh_logging_config()
Commands the container or manager to read in again the logging
configuration from the CDB and to reconfigure the loggers accordingly.
|
org.omg.CORBA.Object |
restart_component(int compHandle)
Not yet implemented.
|
void |
set_component_shutdown_order(int[] handleSeq)
Called by the manager to update the container's knowledge about optimum shutdown order
of its components.
|
void |
set_default_logLevels(LogLevels levels)
Sets the log levels of the default logging configuration.
|
void |
set_logLevels(java.lang.String logger_name,
LogLevels levels)
Sets log levels for a particular named logger.
|
void |
set_statistics_logger_configuration_byname(java.lang.String logger_name,
LogStatsInformation statsInformation)
Sets logger statistics configuration for a particular named logger.
|
void |
shutdown(int encryptedAction)
Action to take after shutting down (ignored for the time being).
|
void |
taggedmessage(short type,
short messageID,
java.lang.String message) |
protected void |
tryToWaitForContainerStart()
Waits for the container to finish startup, see
containerStartOrbThreadGate. |
public static final int CONTAINER_RELOAD
public static final int CONTAINER_REBOOT
public static final int CONTAINER_EXIT
protected void initFromCdb(boolean isContainerStart)
Timeout is applied for ORB-level client-side timeouts.
UseIFR: The container never uses the IFR. The only indirect support is that method
AcsCorba.createOrb(String[] args, Integer port) sets the matching "-ORBInitRef" arg before ORB initialization,
to support "_get_interface()" calls by components such as the sampling system.
TODO: Should we suppress setting this initial service reference if useIFR==false?
According to Corba spec 4.5.1 we may call ORB#init again and possibly override the init ref setting that was given
when initializing the ORB in the first place (before the CDB could be accessed).
Recovery: Will be used during container login with the manager.
ManagerRetry: TODO: use it
ServerThreads: TODO: Can we override the orb.properties setting from within the application?
LoggingConfig Is taken care of separately by the acsjlog code (class LogConfig)
isContainerStart - Allows different treatment (for some container options)
between the first invocation during the container start and later invocations during CDB refreshs.protected void loginToManager(int attempts)
throws AcsJContainerEx
attempts - The number of attempts to find and login into the manager (0 means forever)AcsJContainerServicesEx - If login fails on an available managerAcsJContainerExpublic int get_handle()
public ComponentInfo activate_component(int componentHandle,
long execution_id,
java.lang.String compName,
java.lang.String exe,
java.lang.String type)
throws CannotActivateComponentEx
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
ComponentHelper.type - the type of the component to instantiate (Corba IR id).CannotActivateComponentExsi.ijs.maci.ContainerOperations#activate_component(int, String, String, String)public void activate_component_async(int h,
long execution_id,
java.lang.String name,
java.lang.String exe,
java.lang.String type,
CBComponentInfo callback,
CBDescIn desc)
public void set_component_shutdown_order(int[] handleSeq)
deactivate_component(int) in a regular shutdown.public void deactivate_component(int handle)
throws ComponentDeactivationUncleanEx,
ComponentDeactivationFailedEx
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!ComponentDeactivationUncleanExComponentDeactivationFailedExsi.ijs.maci.ContainerOperations#deactivate_component(int),
ComponentAdapter.deactivateComponent()public org.omg.CORBA.Object restart_component(int compHandle)
throws CannotRestartComponentEx
from maci idl: Restarts a component. Returns a new reference of the restarted component.
compHandle - Handle of the component to be restarted.CannotRestartComponentExsi.ijs.maci.ContainerOperations#restart_component(int)public void shutdown(int encryptedAction)
si.ijs.maci.ContainerOperations#shutdown(int)public ComponentInfo[] get_component_info(int[] handles)
handles - si.ijs.maci.ContainerOperations#get_component_info(int[])public java.lang.String name()
si.ijs.maci.ClientOperations#name()public void disconnect()
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.
si.ijs.maci.ClientOperations#disconnect()public AuthenticationData authenticate(long execution_id,
java.lang.String question)
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:
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.
si.ijs.maci.ClientOperations#authenticate(String)public void message(short type,
java.lang.String message)
si.ijs.maci.ClientOperations#message(short, String)public void taggedmessage(short type,
short messageID,
java.lang.String message)
si.ijs.maci.ClientOperations#taggedmessage(short, short, String)public boolean ping()
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.
si.ijs.maci.ClientOperations#ping()public void components_available(ComponentInfo[] components)
si.ijs.maci.ClientOperations#components_available(ComponentInfo[])public void components_unavailable(java.lang.String[] component_names)
si.ijs.maci.ClientOperations#components_unavailable(String[])public LogLevels get_default_logLevels()
public void set_default_logLevels(LogLevels levels)
throws IllegalLogLevelsEx
IllegalLogLevelsExpublic java.lang.String[] get_logger_names()
The returned logger names are randomly ordered.
public LogLevels get_logLevels(java.lang.String logger_name)
throws LoggerDoesNotExistEx
For possible convenience, the default levels are returned in addition to
setting LogLevels#useDefault to true.
LoggerDoesNotExistExpublic void set_logLevels(java.lang.String logger_name,
LogLevels levels)
throws LoggerDoesNotExistEx,
IllegalLogLevelsEx
LoggerDoesNotExistExIllegalLogLevelsExpublic void refresh_logging_config()
Note that unlike for the logging initialization in initialize(),
now we give precedence to the CDB values over any previous settings.
public LogStatsInformation[] get_statistics_logger_configuration()
public LogStatsInformation get_statistics_logger_configuration_byname(java.lang.String logger_name)
throws alma.Logging.LoggerDoesNotExistEx
alma.Logging.LoggerDoesNotExistExpublic void set_statistics_logger_configuration_byname(java.lang.String logger_name,
LogStatsInformation statsInformation)
throws alma.Logging.LoggerDoesNotExistEx
alma.Logging.LoggerDoesNotExistExprotected void tryToWaitForContainerStart()
containerStartOrbThreadGate.
Does not expose InterruptedException, so that in case of such an exception
this method will return without the container having finished its startup.