MQ-2404 : Configurable KahaDBStore verbosity.. -Dorg.apache.activemq.store.kahadb.LOG_SLOW_ACCESS_TIME=300 system prop now supported.

git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@818224 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Hiram R. Chirino 2009-09-23 19:46:21 +00:00
parent 15c2c96609
commit 35658c7c7b
1 changed files with 8 additions and 4 deletions

View File

@ -59,12 +59,16 @@ import org.apache.kahadb.util.*;
public class MessageDatabase {
public static final String PROPERTY_LOG_SLOW_ACCESS_TIME = "org.apache.activemq.store.kahadb.LOG_SLOW_ACCESS_TIME";
public static final int LOG_SLOW_ACCESS_TIME = Integer.parseInt(System.getProperty(PROPERTY_LOG_SLOW_ACCESS_TIME, "500"));
private static final Log LOG = LogFactory.getLog(MessageDatabase.class);
private static final int DATABASE_LOCKED_WAIT_DELAY = 10 * 1000;
public static final int CLOSED_STATE = 1;
public static final int OPEN_STATE = 2;
protected class Metadata {
protected Page<Metadata> page;
protected int state;
@ -566,8 +570,8 @@ public class MessageDatabase {
});
}
long end = System.currentTimeMillis();
if( end-start > 100 ) {
LOG.info("KahaDB Cleanup took "+(end-start));
if( LOG_SLOW_ACCESS_TIME>0 && end-start > LOG_SLOW_ACCESS_TIME) {
LOG.info("Slow KahaDB access: cleanup took "+(end-start));
}
} catch (IOException e) {
e.printStackTrace();
@ -612,8 +616,8 @@ public class MessageDatabase {
long start2 = System.currentTimeMillis();
process(data, location);
long end = System.currentTimeMillis();
if( end-start > 100 ) {
LOG.info("KahaDB long enqueue time: Journal Add Took: "+(start2-start)+" ms, Index Update took "+(end-start2)+" ms");
if( LOG_SLOW_ACCESS_TIME>0 && end-start > LOG_SLOW_ACCESS_TIME) {
LOG.info("Slow KahaDB access: Journal append took: "+(start2-start)+" ms, Index update took "+(end-start2)+" ms");
}
synchronized (indexMutex) {