public abstract class AlarmDumperBase extends AdvancedComponentClient
The pattern for using a dumper is:
receiveAlarms()
tearDown()
receiveAlarms() blocks until the user presses CTRL-C a signal is received
or tearDown() is called.
receiveAlarms(long, TimeUnit) can be used instead of receiveAlarms()
if the receiving has to terminate after the specified timeout.
tearDown() must be called before terminating to cleanly exit.
m_logger, m_shutdownHook| Constructor and Description |
|---|
AlarmDumperBase(java.util.logging.Logger theLogger,
java.lang.String mangerLoc,
java.lang.String clientname)
Constructor
|
| Modifier and Type | Method and Description |
|---|---|
static void |
clientRunner(java.lang.String[] args,
boolean isSourceClient,
long timeout,
java.util.concurrent.TimeUnit timeUnit)
This block of code avoid code replication.
|
abstract void |
close()
Close the resources of the alarm client
|
java.lang.String |
formatTimestamp(java.sql.Timestamp timestamp)
Return the timestamp in ISO format.
|
void |
receiveAlarms()
Connect the client
This method never stops.
|
void |
receiveAlarms(long timeout,
java.util.concurrent.TimeUnit timeUnit)
Connect the client until the timeout elapses or the user presses CTRL-C
This method never when the timeout elapse or the user presses CTRL-C
|
protected void |
registerShutdownHook()
AlarmDumperBase registers its own shutdown hook in fact what is provided
by ComponentClient logs a few warnings if the process is interrupted
but in this case the situation is absolutely normal. |
abstract void |
startReceivingAlarms()
Connects to the NC and start receiving alarms.
|
void |
tearDown()
Cleanly tear down
|
createContainerServices, destroyContainerServices, getAcsCorba, getAcsManagerProxygetContainerServices, initAlarmSystem, initRemoteLogging, tearDownAlarmSystempublic AlarmDumperBase(java.util.logging.Logger theLogger,
java.lang.String mangerLoc,
java.lang.String clientname)
throws java.lang.Exception
theLogger - The loggermangerLoc - The CORBA loc of the managerclientname - The name of the clientjava.lang.Exception - if an error happens instantiating the AdvancedComponentClientpublic abstract void startReceivingAlarms()
throws java.lang.Exception
This must be implemented to connect to the right NC.
If the connection failed, startReceivingAlarms() must thrown an exception
java.lang.Exceptionpublic void receiveAlarms()
throws java.lang.Exception
java.lang.Exception - In case of error connecting the SourceClientpublic void receiveAlarms(long timeout,
java.util.concurrent.TimeUnit timeUnit)
throws java.lang.Exception
java.lang.Exception - In case of error connecting the SourceClientpublic abstract void close()
throws java.lang.Exception
java.lang.Exceptionpublic void tearDown()
tearDown in class ComponentClientprotected void registerShutdownHook()
AlarmDumperBase registers its own shutdown hook in fact what is provided
by ComponentClient logs a few warnings if the process is interrupted
but in this case the situation is absolutely normal.registerShutdownHook in class ComponentClientpublic java.lang.String formatTimestamp(java.sql.Timestamp timestamp)
timestamp - public static void clientRunner(java.lang.String[] args,
boolean isSourceClient,
long timeout,
java.util.concurrent.TimeUnit timeUnit)
args - Command line argsisSourceClient - true if a source client must be instantiated,
false for category clienttimeout - If greater then 0 the process waits until the timeout elapsestimeUnit - The TimeUnit for the timeout (must be not null if the timeout is greater then 0)