Package xal.service.pvlogger
Class LoggerSession
java.lang.Object
xal.service.pvlogger.LoggerSession
LoggerSession manages a session of logging machine state. One can create an
instance to log the current machine state either on demand or periodically.
- Author:
- tap
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final doubledefault logging period in secondsprotected booleanprotected final LoggerChangeListenerprotected ChannelGroupprotected static final intinitial timer delayprotected MachineSnapshotlatest snapshot taken which may or may not have been publishedprotected doublelogging period in secondsprotected TimerTaskprotected final Timerprotected final MessageCenterprotected final xal.service.pvlogger.SnapshotPublisherpublisher of snapshots to the persistent store -
Constructor Summary
ConstructorsConstructorDescriptionLoggerSession(ChannelGroup group, xal.service.pvlogger.SnapshotPublisher publisher) LoggerSession constructor -
Method Summary
Modifier and TypeMethodDescriptionvoidaddLoggerChangeListener(LoggerChangeListener listener) Add a logger change listener to receive logger change events.protected voiddispose of the logging taskGet the active channel group for this sessionGet the channels which we are attempting to monitor and logGet the latest machine snapshot which may or may not have been publisheddoubleGet the loggin period.booleanDetermine whether this logger session is enabledbooleanReveal whether the logger is scheduled to run periodicallyprotected final TimerTaskget a new timer task for periodic loggingfinal voidpublishSnapshot(MachineSnapshot machineSnapshot) Publish the machine snapshot to the persistent storage.voidRemove a logger change listener from receiving logger change events.voidResume periodic logging with the most recent settings if enabled.voidsetChannelGroup(ChannelGroup group) Set the channel group for this logger sessionprotected voidsetEnabled(boolean enable) Set whether this session should be enabledvoidsetLoggingPeriod(double period) Set the period between events where we take and store machine snapshots.voidStart periodically logging machine state to the persistent storage.voidstartLogging(double period) Start periodically logging machine state to the persistent storage.voidStop the periodic machine state logging.final MachineSnapshotTake a snapshot and publish it immediatelyfinal MachineSnapshottakeAndPublishSnapshot(String comment) Take a snapshot and publish it immediatelyprotected final MachineSnapshotTake a snapshot and schedule it for publicationfinal MachineSnapshotTake a snapshot of the current machine state.
-
Field Details
-
INITIAL_DELAY
protected static final int INITIAL_DELAYinitial timer delay- See Also:
-
DEFAULT_LOGGING_PERIOD
protected static final double DEFAULT_LOGGING_PERIODdefault logging period in seconds- See Also:
-
snapshotPublisher
protected final xal.service.pvlogger.SnapshotPublisher snapshotPublisherpublisher of snapshots to the persistent store -
latestMachineSnapshot
latest snapshot taken which may or may not have been published -
messageCenter
-
eventProxy
-
group
-
logTimer
-
logTask
-
loggingPeriod
protected double loggingPeriodlogging period in seconds -
enabled
protected boolean enabled
-
-
Constructor Details
-
LoggerSession
LoggerSession constructor- Parameters:
group- Group of channels to log.publisher- The snapshot publisher.
-
-
Method Details
-
addLoggerChangeListener
Add a logger change listener to receive logger change events.- Parameters:
listener- The listener of the logger change events.
-
removeLoggerChangeListener
Remove a logger change listener from receiving logger change events.- Parameters:
listener- The listener of the logger change events.
-
resumeLogging
public void resumeLogging()Resume periodic logging with the most recent settings if enabled. -
startLogging
public void startLogging()Start periodically logging machine state to the persistent storage. -
startLogging
public void startLogging(double period) Start periodically logging machine state to the persistent storage.- Parameters:
period- The period in seconds between events where we take and store machine snapshots.
-
stopLogging
public void stopLogging()Stop the periodic machine state logging. -
isLogging
public boolean isLogging()Reveal whether the logger is scheduled to run periodically- Returns:
- true if the logger is scheduled to run periodically or false otherwise
-
setLoggingPeriod
public void setLoggingPeriod(double period) Set the period between events where we take and store machine snapshots.- Parameters:
period- The period in seconds between events where we take and store machine snapshots.
-
getLoggingPeriod
public double getLoggingPeriod()Get the loggin period.- Returns:
- The period in seconds between events where we take and store machine snapshots.
-
isEnabled
public boolean isEnabled()Determine whether this logger session is enabled- Returns:
- true if this logger session is enabled and false if not
-
setEnabled
protected void setEnabled(boolean enable) Set whether this session should be enabled- Parameters:
enable- true to enable this session and false to disable it
-
getChannelGroup
Get the active channel group for this session- Returns:
- the channel group
-
setChannelGroup
Set the channel group for this logger session- Parameters:
group- the new channel group for this logger session
-
getChannels
Get the channels which we are attempting to monitor and log- Returns:
- a collection of the channels we wish to monitor and log
-
getLatestMachineSnapshot
Get the latest machine snapshot which may or may not have been published- Returns:
- the latest machine snapshot
-
takeAndPublishSnapshot
Take a snapshot and publish it immediately- Returns:
- the published snapshot
-
takeAndPublishSnapshot
Take a snapshot and publish it immediately- Parameters:
comment- machine snapshot comment- Returns:
- the published snapshot
-
takeAndScheduleSnapshotForPublication
Take a snapshot and schedule it for publication- Returns:
- the scheduled snapshot
-
takeSnapshot
Take a snapshot of the current machine state.- Returns:
- A snapshot of the current machine state.
-
publishSnapshot
Publish the machine snapshot to the persistent storage.- Parameters:
machineSnapshot- The machine snapshot to publish.
-
disposeLoggingTask
protected void disposeLoggingTask()dispose of the logging task -
newLoggingTask
get a new timer task for periodic logging
-