Crossfire JXClient, Trunk
|
Public Member Functions | |
void | clearLogs () throws IOException, InstanceNotFoundException |
long | getLogFileCapacity () throws IOException, InstanceNotFoundException |
String | getLogFileName () throws IOException, InstanceNotFoundException |
long | getLoggedCount () throws IOException, InstanceNotFoundException |
ResultRecord[] | getMemoryLog () throws IOException, InstanceNotFoundException |
int | getMemoryLogCapacity () throws IOException, InstanceNotFoundException |
void | log (ResultRecord record) throws IOException, InstanceNotFoundException |
void | newLogFile (String basename, long maxRecord) throws IOException, InstanceNotFoundException |
void | setLogFileCapacity (long maxRecord) throws IOException, InstanceNotFoundException |
void | setMemoryLogCapacity (int size) throws IOException, InstanceNotFoundException |
The ResultLogManagerMXBean
is in charge of managing result logs. DirectoryScanners can be configured to log a ResultRecord whenever they take action upon a file that matches their set of matching criteria. The ResultLogManagerMXBean
is responsible for storing these results in its result logs.
The ResultLogManagerMXBean
will let you interactively clear these result logs, change their capacity, and decide where (memory or file or both) the ResultRecords should be stored.
The memory log is useful in so far that its content can be interactively returned by the ResultLogManagerMXBean
. The file log doesn't have this facility.
The result logs are intended to be used by e.g. an offline program that would take some actions on the files that were matched by the scanners criteria:
The scandir application could be configured to only produce logs (i.e. takes no action but logging the matching files), and the real action (e.g. mail the result log to the engineer which maintains the lab, or parse the log and prepare and send a single mail to the matching files owners, containing the list of file he/she should consider deleting) could be performed by such another program/module.
Definition at line 73 of file ResultLogManagerMXBean.java.
void com.sun.jmx.examples.scandir.ResultLogManagerMXBean.clearLogs | ( | ) | throws IOException, InstanceNotFoundException |
Clears the memory log and result log file.
IOException | A connection problem occurred when accessing the underlying resource. |
InstanceNotFoundException | The underlying MBean is not registered in the MBeanServer. |
Implemented in com.sun.jmx.examples.scandir.ResultLogManager.
long com.sun.jmx.examples.scandir.ResultLogManagerMXBean.getLogFileCapacity | ( | ) | throws IOException, InstanceNotFoundException |
Gets the maximum number of records that can be logged in the result log file.
When that maximum number of records is reached the ResultLogManager will rename the result log file by appending a '~' to its name, and a new empty log file will be created.
IOException | A connection problem occurred when accessing the underlying resource. |
InstanceNotFoundException | The underlying MBean is not registered in the MBeanServer. |
Implemented in com.sun.jmx.examples.scandir.ResultLogManager.
String com.sun.jmx.examples.scandir.ResultLogManagerMXBean.getLogFileName | ( | ) | throws IOException, InstanceNotFoundException |
Gets the name of the current result log file.
null
means that no log file is configured: logging to file is disabled.
null
if logging to file is disabled. IOException | A connection problem occurred when accessing the underlying resource. |
InstanceNotFoundException | The underlying MBean is not registered in the MBeanServer. |
Implemented in com.sun.jmx.examples.scandir.ResultLogManager.
long com.sun.jmx.examples.scandir.ResultLogManagerMXBean.getLoggedCount | ( | ) | throws IOException, InstanceNotFoundException |
Gets The number of records that have been logged in the current result log file. This will always be less than getLogFileCapacity().
IOException | A connection problem occurred when accessing the underlying resource. |
InstanceNotFoundException | The underlying MBean is not registered in the MBeanServer. |
Implemented in com.sun.jmx.examples.scandir.ResultLogManager.
ResultRecord [] com.sun.jmx.examples.scandir.ResultLogManagerMXBean.getMemoryLog | ( | ) | throws IOException, InstanceNotFoundException |
Gets the whole content of the memory log. This cannot exceed getMemoryLogCapacity records.
IOException | A connection problem occurred when accessing the underlying resource. |
InstanceNotFoundException | The underlying MBean is not registered in the MBeanServer. |
Implemented in com.sun.jmx.examples.scandir.ResultLogManager.
int com.sun.jmx.examples.scandir.ResultLogManagerMXBean.getMemoryLogCapacity | ( | ) | throws IOException, InstanceNotFoundException |
Gets the maximum number of records that can be logged in the memory log.
A non positive value - 0
or negative - means that logging in memory is disabled.
The memory log is a FIFO: when its maximum capacity is reached, its head element is removed to make place for a new element at its tail.
IOException | A connection problem occurred when accessing the underlying resource. |
InstanceNotFoundException | The underlying MBean is not registered in the MBeanServer. |
Implemented in com.sun.jmx.examples.scandir.ResultLogManager.
void com.sun.jmx.examples.scandir.ResultLogManagerMXBean.log | ( | ResultRecord | record | ) | throws IOException, InstanceNotFoundException |
Logs a result record to the active result logs (memory,file,both,or none) depending on how this MBean is currently configured.
record | The result record to log. |
IOException | A connection problem occurred when accessing the underlying resource. |
InstanceNotFoundException | The underlying MBean is not registered in the MBeanServer. |
Implemented in com.sun.jmx.examples.scandir.ResultLogManager.
void com.sun.jmx.examples.scandir.ResultLogManagerMXBean.newLogFile | ( | String | basename, |
long | maxRecord | ||
) | throws IOException, InstanceNotFoundException |
Creates a new log file in which to store results.
When this method is called, the ResultLogManager will stop logging in its current log file and use the new specified file instead. If that file already exists, it will be renamed by appending a '~' to its name, and a new empty file with the name specified by basename will be created.
Calling this method has no side effect on the {InitialResultLogConfig} held in the ScanDirConfigMXBean} configuration. To apply these new values to the ScanDirConfigMXBean} configuration, you must call { ScanManagerMXBean#applyCurrentResultLogConfig ScanManagerMXBean.applyCurrentResultLogConfig}.
basename | The name of the new log file. This will be the new name returned by getLogFileName. |
maxRecord | maximum number of records to log in the specified file before creating a new file. maxRecord will be the new value returned by getLogFileCapacity. When that maximum number of records is reached the ResultLogManager will rename the file by appending a '~' to its name, and a new empty log file will be created. |
IOException | A connection problem occurred when accessing the underlying resource. |
InstanceNotFoundException | The underlying MBean is not registered in the MBeanServer. |
Implemented in com.sun.jmx.examples.scandir.ResultLogManager.
void com.sun.jmx.examples.scandir.ResultLogManagerMXBean.setLogFileCapacity | ( | long | maxRecord | ) | throws IOException, InstanceNotFoundException |
Sets the maximum number of records that can be logged in the result log file.
When that maximum number of records is reached the ResultLogManager will rename the result log file by appending a '~' to its name, and a new empty log file will be created.
If logging to file is disabled calling this method is irrelevant.
maxRecord | maximum number of records to log in the result log file. |
IOException | A connection problem occurred when accessing the underlying resource. |
InstanceNotFoundException | The underlying MBean is not registered in the MBeanServer. |
Implemented in com.sun.jmx.examples.scandir.ResultLogManager.
void com.sun.jmx.examples.scandir.ResultLogManagerMXBean.setMemoryLogCapacity | ( | int | size | ) | throws IOException, InstanceNotFoundException |
Sets the maximum number of records that can be logged in the memory log.
The memory log is a FIFO: when its maximum capacity is reached, its head element is removed to make place for a new element at its tail.
size | The maximum number of result records that can be logged in the memory log. |
A non positive value - 0
or negative - means that logging in memory is disabled. It will also have the side effect of clearing the memory log.
IOException | A connection problem occurred when accessing the underlying resource. |
InstanceNotFoundException | The underlying MBean is not registered in the MBeanServer. |
Implemented in com.sun.jmx.examples.scandir.ResultLogManager.