MessageHistory cleanups
This commit is contained in:
@ -39,9 +39,8 @@ public class MessageHistory {
|
|||||||
private final static byte[] NL = System.getProperty("line.separator").getBytes();
|
private final static byte[] NL = System.getProperty("line.separator").getBytes();
|
||||||
private final static int FLUSH_SIZE = 1000; // write out at least once every 1000 entries
|
private final static int FLUSH_SIZE = 1000; // write out at least once every 1000 entries
|
||||||
|
|
||||||
/** config property determining whether we want to debug with the message history */
|
/** config property determining whether we want to debug with the message history - default false */
|
||||||
public final static String PROP_KEEP_MESSAGE_HISTORY = "router.keepHistory";
|
public final static String PROP_KEEP_MESSAGE_HISTORY = "router.keepHistory";
|
||||||
public final static boolean DEFAULT_KEEP_MESSAGE_HISTORY = false;
|
|
||||||
/** config property determining where we want to log the message history, if we're keeping one */
|
/** config property determining where we want to log the message history, if we're keeping one */
|
||||||
public final static String PROP_MESSAGE_HISTORY_FILENAME = "router.historyFilename";
|
public final static String PROP_MESSAGE_HISTORY_FILENAME = "router.historyFilename";
|
||||||
public final static String DEFAULT_MESSAGE_HISTORY_FILENAME = "messageHistory.txt";
|
public final static String DEFAULT_MESSAGE_HISTORY_FILENAME = "messageHistory.txt";
|
||||||
@ -67,19 +66,8 @@ public class MessageHistory {
|
|||||||
String getFilename() { return _historyFile; }
|
String getFilename() { return _historyFile; }
|
||||||
|
|
||||||
private void updateSettings() {
|
private void updateSettings() {
|
||||||
String keepHistory = _context.router().getConfigSetting(PROP_KEEP_MESSAGE_HISTORY);
|
_doLog = Boolean.valueOf(_context.getProperty(PROP_KEEP_MESSAGE_HISTORY)).booleanValue();
|
||||||
if (keepHistory != null) {
|
_historyFile = _context.getProperty(PROP_MESSAGE_HISTORY_FILENAME, DEFAULT_MESSAGE_HISTORY_FILENAME);
|
||||||
_doLog = Boolean.TRUE.toString().equalsIgnoreCase(keepHistory);
|
|
||||||
} else {
|
|
||||||
_doLog = DEFAULT_KEEP_MESSAGE_HISTORY;
|
|
||||||
}
|
|
||||||
|
|
||||||
String filename = null;
|
|
||||||
if (_doLog) {
|
|
||||||
filename = _context.router().getConfigSetting(PROP_MESSAGE_HISTORY_FILENAME);
|
|
||||||
if ( (filename == null) || (filename.trim().length() <= 0) )
|
|
||||||
filename = DEFAULT_MESSAGE_HISTORY_FILENAME;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -96,13 +84,6 @@ public class MessageHistory {
|
|||||||
_reinitializeJob.getTiming().setStartAfter(_context.clock().now()+5000);
|
_reinitializeJob.getTiming().setStartAfter(_context.clock().now()+5000);
|
||||||
_context.jobQueue().addJob(_reinitializeJob);
|
_context.jobQueue().addJob(_reinitializeJob);
|
||||||
} else {
|
} else {
|
||||||
String filename = null;
|
|
||||||
filename = _context.router().getConfigSetting(PROP_MESSAGE_HISTORY_FILENAME);
|
|
||||||
if ( (filename == null) || (filename.trim().length() <= 0) )
|
|
||||||
filename = DEFAULT_MESSAGE_HISTORY_FILENAME;
|
|
||||||
|
|
||||||
_doLog = DEFAULT_KEEP_MESSAGE_HISTORY;
|
|
||||||
_historyFile = filename;
|
|
||||||
_localIdent = getName(_context.routerHash());
|
_localIdent = getName(_context.routerHash());
|
||||||
// _unwrittenEntries = new ArrayList(64);
|
// _unwrittenEntries = new ArrayList(64);
|
||||||
updateSettings();
|
updateSettings();
|
||||||
|
Reference in New Issue
Block a user