
public class Subsystem extends Agent
This object will register itself on the three buses (control, status, log). It broadcasts its status, and can receive Commands.
Agent.RunningCommandcommandExecutorLock, currentAction, currentQueries, currentSignals, heartbeatPublisher, innerStateLock, logBusHandler, runtimeInfoPublisher| Constructor and Description |
|---|
Subsystem(String name,
AgentInfo.AgentType type)
Constructs Subsystem instance.
|
| Modifier and Type | Method and Description |
|---|---|
void |
abort()
Command to abort operation.
|
void |
abort(long expectedMaxDelay)
Deprecated.
|
void |
addClearAlertHandler(ClearAlertHandler handler)
Add a ClearAlertHandler to this Subsystem.
|
void |
checkAllHardwareStarted()
Called to check if all hardware has been correctly started.
|
void |
checkAllHardwareStopped()
Called to check if all hardware has been correctly started.
|
void |
checkHardware()
Called before activating anything and again once problems are supposed to
have been addressed.
|
String[] |
clearAlerts(String... alertId)
Clear one or more Alerts by providing the alert id.
|
String[] |
clearAllAlerts()
Attempt to clear all the outstanding alerts.
|
void |
completeInitialization()
Command to complete initialization (if commands were issued to heal
hardware problems).
|
void |
completeInitialization(boolean checkHardwareOK)
Runs the last phase of the initialization, and transitions to OPERATIONAL
state.
|
void |
doShutdown()
Called upon subsystem shutdown.
|
void |
doStart()
Called upon subsystem start.
|
void |
forceShutdown()
Command to force subsystem shutdown.
|
Logger |
getLogger()
Returns the current logger (use sparingly and prefer your own logger).
|
int |
getNumberCommandThreads()
Command that returns the number of currently running commands.
|
RaisedAlertSummary |
getRaisedAlertSummary()
Get the Subsystem's RaisedAlertSummary.
|
protected void |
internalShutdown()
Called by the framework on subsystem shutdown, before the Agent shutdown
sequence is executed.
|
protected boolean |
internalStart()
Called by the framework once the underlying
Agent functionality
is initialized. |
void |
ping()
Command to broadcast a message of presence on the status bus.
|
void |
postStart()
Called by the framework after subsystem has been started.
|
String |
printRunningCommands()
Command returning a String describing which commands are running.
|
void |
raiseAlert(Alert alert,
AlertState severity)
Deprecated.
|
void |
raiseAlert(Alert alert,
AlertState severity,
String cause)
Raise an Alert with a given AlertState.
|
void |
removeLogPanicState()
Command to try and reset the panic state of a the Log Bus Handler
(logging failed before).
|
void |
setBusLogHandlerLevel(String levelName)
Command to set the level at which the Log Bus Hander will start logging.
|
void |
setLogFormat(String format)
Command to set a format for the TextFormatter of LogBusHandler (see
logging.properties doc).
|
void |
setLogHandlerLevel(String handler,
String level)
Command to set a level for a given handler
|
void |
setLogLevel(String keyLogger,
String levelName)
Command to set the Level of a named Logger.
|
void |
setStackTraceDepth(int depth)
Will modify the depth of stackTrace printing for ALL handlers (including
the LogBusHandler)
|
void |
stop(long expectedMaxDelay)
Command to stop operation.
|
boolean |
switchToEngineeringMode()
Command to switch to ENGINEERING mode.
|
void |
switchToNormalMode()
Command to switch to NORMAL mode.
|
addCommandSet, addCommandsFromObject, broadcastStatus, executeCommandRequest, getAgentInfo, getCCSVersions, getCommandCount, getCommandSet, getCommandTargets, getCurrentAction, getDictionaries, getDistributionInfo, getEnvironmentMessagingAccess, getMessagingAccess, getName, getScheduler, getState, getState, getStatusBroadcastPeriod, isInEngineeringMode, isInState, isInState, publishStateChange, publishSubsystemDataOnStatusBus, sendAck, sendNack, setAgentProperty, shutdown, start, updateAgentState, updateHeartBeat, updateInternalState, waitForpublic Subsystem(String name, AgentInfo.AgentType type)
name - name of the subsystem : cannot be nulltype - Agent typeprotected final boolean internalStart()
Agent functionality
is initialized.internalStart in class Agenttrue if subsystem initialization was successful.protected final void internalShutdown()
throws Exception
internalShutdown in class AgentException - if shutdown failspublic void completeInitialization(boolean checkHardwareOK)
throws HardwareException
checkHardwareOK - false if engineering fault was entered due to
checkHardware errorsHardwareException - if some hardware is still not startedpublic void postStart()
throws HardwareException
HardwareException - because some "homing" operations may be tried
by the hardwarepublic Logger getLogger()
public void checkHardware()
throws HardwareException
HardwareException - "compound" exceptionpublic void checkAllHardwareStarted()
throws HardwareException
HardwareException - a compound exception that list the exceptions
fired by hardwares that are not started.public void checkAllHardwareStopped()
throws HardwareException
HardwareException - a compound exception that list the exceptions
fired by hardwares that are not stopped.public void doStart()
public void doShutdown()
@Command(description="completes initialization after hardware problems corrections", type=ACTION) public void completeInitialization() throws SystemStateException, HardwareException
@Command(description="forces blocked shutdown (not implemented yet!)", type=SIGNAL) public void forceShutdown()
@Command(description="abort subsystem", type=SIGNAL) public void abort()
@Command(description="halt hardware with expected max delay", type=SIGNAL) @Deprecated public void abort(long expectedMaxDelay)
@Command(description="stops hardware with expected max delay", type=ACTION) public void stop(long expectedMaxDelay) throws HardwareException
expectedMaxDelay - time limit for executionHardwareException@Command(description="switch to ENGINEERING mode", type=ACTION) public boolean switchToEngineeringMode()
true if the subsystem state has changed as a result of
execution@Command(description="Tries to get back to NORMAL mode", type=ACTION) public final void switchToNormalMode() throws SystemStateException
SystemStateException - if alarms are not cleared or signals are
still runningpublic final void addClearAlertHandler(ClearAlertHandler handler)
handler - The ClearAlertHandler.public final void raiseAlert(Alert alert, AlertState severity, String cause)
alert - The Alert instance to be raisedseverity - The AlertState of this Alert.cause - The reason the Alert was raised.@Deprecated public final void raiseAlert(Alert alert, AlertState severity)
@Command(description="Clear alerts", type=ACTION) public final String[] clearAlerts(String... alertId)
alertId - the Id of the Alerts to be cleared.@Command(description="Clear all alerts", type=ACTION) public final String[] clearAllAlerts()
@Command(description="Get the Raised Alert Summary", type=QUERY) public final RaisedAlertSummary getRaisedAlertSummary()
@Command(description="set the level of the BusLogHandler", type=QUERY) public void setBusLogHandlerLevel(String levelName)
levelName - name of JUL Level@Command(description="set the level of a Logger", type=QUERY) public void setLogLevel(String keyLogger, String levelName)
keyLogger - name of Logger (can be a package or a "concern" such as
"INIT", "CONFIG"levelName - the name of a JUL Level@Command(description="sets the the depth of stacktraces in Logger messages", type=QUERY) public void setStackTraceDepth(int depth)
depth - could be negative if we want all the stackTrace@Command(description="sets the format used by TextFormatter for LogEvent messages ", type=QUERY) public void setLogFormat(String format)
format - @Command(description="sets the handler (ConsoleHandler, FileHandler, LogBusHandler) log level", type=QUERY) public void setLogHandlerLevel(String handler, String level)
handler - can be ConsoleHandler, FileHandler, LogBusHandlerlevel - @Command(description="tries to stop the panic state of logmanagement", type=QUERY) public void removeLogPanicState()
@Command(description="gets the number of commands which are currently running (except the current one!)", type=QUERY) public int getNumberCommandThreads()
@Command(description="gets the name of commands which are currently running", type=QUERY) public String printRunningCommands()
Copyright © 2016 LSST. All rights reserved.