public class LoggerSession
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
protected boolean |
_enabled |
protected ChannelGroup |
_group |
protected MachineSnapshot |
_latestMachineSnapshot
latest snapshot taken which may or may not have been published
|
protected double |
_loggingPeriod |
protected java.util.TimerTask |
_logTask |
protected static double |
DEFAULT_LOGGING_PERIOD
default logging period in seconds
|
protected LoggerChangeListener |
EVENT_PROXY |
protected int |
INITIAL_DELAY
initial timer delay
|
protected java.util.Timer |
LOG_TIMER |
protected MessageCenter |
MESSAGE_CENTER |
protected xal.service.pvlogger.SnapshotPublisher |
SNAPSHOT_PUBLISHER
publisher of snapshots to the persistent store
|
Constructor and Description |
---|
LoggerSession(ChannelGroup group,
xal.service.pvlogger.SnapshotPublisher publisher)
LoggerSession constructor
|
Modifier and Type | Method and Description |
---|---|
void |
addLoggerChangeListener(LoggerChangeListener listener)
Add a logger change listener to receive logger change events.
|
protected void |
disposeLoggingTask()
dispose of the logging task
|
ChannelGroup |
getChannelGroup()
Get the active channel group for this session
|
java.util.Collection<Channel> |
getChannels()
Get the channels which we are attempting to monitor and log
|
MachineSnapshot |
getLatestMachineSnapshot()
Get the latest machine snapshot which may or may not have been published
|
double |
getLoggingPeriod()
Get the loggin period.
|
boolean |
isEnabled()
Determine whether this logger session is enabled
|
boolean |
isLogging()
Reveal whether the logger is scheduled to run periodically
|
protected java.util.TimerTask |
newLoggingTask()
get a new timer task for periodic logging
|
void |
publishSnapshot(MachineSnapshot machineSnapshot)
Publish the machine snapshot to the persistent storage.
|
void |
removeLoggerChangeListener(LoggerChangeListener listener)
Remove a logger change listener from receiving logger change events.
|
void |
resumeLogging()
Resume periodic logging with the most recent settings if enabled.
|
void |
setChannelGroup(ChannelGroup group)
Set the channel group for this logger session
|
protected void |
setEnabled(boolean enable)
Set whether this session should be enabled
|
void |
setLoggingPeriod(double period)
Set the period between events where we take and store machine snapshots.
|
void |
startLogging()
Start periodically logging machine state to the persistent storage.
|
void |
startLogging(double period)
Start periodically logging machine state to the persistent storage.
|
void |
stopLogging()
Stop the periodic machine state logging.
|
MachineSnapshot |
takeAndPublishSnapshot()
Take a snapshot and publish it immediately
|
MachineSnapshot |
takeAndPublishSnapshot(java.lang.String comment)
Take a snapshot and publish it immediately
|
protected MachineSnapshot |
takeAndScheduleSnapshotForPublication()
Take a snapshot and schedule it for publication
|
MachineSnapshot |
takeSnapshot()
Take a snapshot of the current machine state.
|
protected final int INITIAL_DELAY
protected static final double DEFAULT_LOGGING_PERIOD
protected xal.service.pvlogger.SnapshotPublisher SNAPSHOT_PUBLISHER
protected volatile MachineSnapshot _latestMachineSnapshot
protected final MessageCenter MESSAGE_CENTER
protected final LoggerChangeListener EVENT_PROXY
protected ChannelGroup _group
protected final java.util.Timer LOG_TIMER
protected java.util.TimerTask _logTask
protected double _loggingPeriod
protected boolean _enabled
public LoggerSession(ChannelGroup group, xal.service.pvlogger.SnapshotPublisher publisher)
group
- Group of channels to log.publisher
- The snapshot publisher.public void addLoggerChangeListener(LoggerChangeListener listener)
listener
- The listener of the logger change events.public void removeLoggerChangeListener(LoggerChangeListener listener)
listener
- The listener of the logger change events.public void resumeLogging()
public void startLogging()
public void startLogging(double period)
period
- The period in seconds between events where we take and store machine snapshots.public void stopLogging()
public boolean isLogging()
public void setLoggingPeriod(double period)
period
- The period in seconds between events where we take and store machine snapshots.public double getLoggingPeriod()
public boolean isEnabled()
protected void setEnabled(boolean enable)
enable
- true to enable this session and false to disable itpublic ChannelGroup getChannelGroup()
public void setChannelGroup(ChannelGroup group)
group
- the new channel group for this logger sessionpublic java.util.Collection<Channel> getChannels()
public MachineSnapshot getLatestMachineSnapshot()
public final MachineSnapshot takeAndPublishSnapshot()
public final MachineSnapshot takeAndPublishSnapshot(java.lang.String comment)
comment
- machine snapshot commentprotected final MachineSnapshot takeAndScheduleSnapshotForPublication()
public final MachineSnapshot takeSnapshot()
public final void publishSnapshot(MachineSnapshot machineSnapshot)
machineSnapshot
- The machine snapshot to publish.protected void disposeLoggingTask()
protected final java.util.TimerTask newLoggingTask()