public final class PersistencyService extends Object implements ServiceLifecycle, HasLifecycle
Persist and to write them into a
local file at subsystem shutdown or at regular time intervals.| Modifier and Type | Method and Description |
|---|---|
void |
afterInit() |
boolean |
isLocalPersistenceFilePresent()
Tells whether a local persistence file exists on the local filesystem for
that agent.
|
boolean |
load()
Reads the persisted data local file and applies the contained value to
the
Persist annotated fields. |
boolean |
persistNow()
Persists the annotated fields values in a local file.
|
void |
preShutdown() |
void |
preStart()
Called from the enclosing
Subsystem when
org.lsst.ccs.Subsystem#start() has been called. |
void |
setAutomatic(boolean loadAtStartup,
boolean persistAtShutdown)
Customize the behavior of the local persistence service.
|
void |
setPersistencyFileName(String fileName) |
void |
shutdown()
Called from the enclosing
Subsystem when
org.lsst.ccs.Subsystem#shutdown() has been called. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitafterBuild, afterStart, preBuild, preInitbuild, init, postBuild, postInit, postShutdown, postStart, startpublic void afterInit()
afterInit in interface ServiceLifecyclepublic void setPersistencyFileName(String fileName)
public void preStart()
ServiceLifecycleSubsystem when
org.lsst.ccs.Subsystem#start() has been called.
The preceding lifecycle step is HasLifecycle.postInit()
The following lifecycle step is HasLifecycle.start()
At the time it is called :
PhaseState is
INITIALIZING
connection with the messaging layer is effective, the enclosing
subsystem has started StatusHeartBeat
publication
preStart in interface ServiceLifecyclepublic void preShutdown()
preShutdown in interface ServiceLifecyclepublic void shutdown()
HasLifecycleSubsystem when
org.lsst.ccs.Subsystem#shutdown() has been called. At the time it
is called :
PhaseState is CLOSING.
org.lsst.ccs.framework.HardwareController#checkStopped() has
been called
shutdown in interface HasLifecyclepublic void setAutomatic(boolean loadAtStartup,
boolean persistAtShutdown)
loadAtStartup - true if the persistence file should be loaded
automatically at startuppersistAtShutdown - true if the persistence file should be written
autmatically at shutdown@Command(description="writes persistent data in local file", category=SYSTEM) public boolean persistNow()
@Command(description="loads persistent data from local file", category=SYSTEM) public boolean load()
Persist annotated fields.
Inconsistent data are silently ignored@Command(description="returns true if a local persistence file is present, false otherwise.", category=SYSTEM) public boolean isLocalPersistenceFilePresent()
Copyright © 2022 LSST. All rights reserved.