[Mulgara-svn] r1792 - trunk/src/jar/util-xa/java/org/mulgara/store/xa
pag at mulgara.org
pag at mulgara.org
Thu Sep 24 23:13:25 UTC 2009
Author: pag
Date: 2009-09-24 16:13:24 -0700 (Thu, 24 Sep 2009)
New Revision: 1792
Modified:
trunk/src/jar/util-xa/java/org/mulgara/store/xa/FreeList.java
Log:
Moved stack traces out of the Phase constructor and into the Phase.use method. Stack traces are not debug only
Modified: trunk/src/jar/util-xa/java/org/mulgara/store/xa/FreeList.java
===================================================================
--- trunk/src/jar/util-xa/java/org/mulgara/store/xa/FreeList.java 2009-09-24 23:12:38 UTC (rev 1791)
+++ trunk/src/jar/util-xa/java/org/mulgara/store/xa/FreeList.java 2009-09-24 23:13:24 UTC (rev 1792)
@@ -37,6 +37,7 @@
import org.apache.log4j.Logger;
import org.mulgara.util.IntFile;
import org.mulgara.util.StackTrace;
+import org.mulgara.util.functional.C;
/**
* A fifo of integer items. A list of "phases" is maintained where each phase
@@ -67,9 +68,6 @@
/** Logger. */
private final static Logger logger = Logger.getLogger(FreeList.class);
- /** Flag used to indicate that the runtime is in debug mode. */
- private final static boolean DEBUG = false;
-
/** The name extension of the file used for the freelist. */
private final static String INTFILE_EXT = "_ph";
@@ -400,7 +398,7 @@
throw new IllegalArgumentException("Trying to free item that was never allocated: " + item);
}
- if (DEBUG && !isValid(item)) throw new AssertionError("Attempt to free an invalid item: " + item);
+ // if (!isValid(item)) throw new AssertionError("Attempt to free an invalid item: " + item);
long head = currentPhase.getHead();
readHeadBlock(getBlockId(head));
@@ -946,8 +944,8 @@
private Reference<Token> tokenRef = null;
- /** Holds a stack trace of construction so we can tell where problems occurred. */
- private StackTrace stack = null;
+ /** Holds stack traces of use so we can tell where problems occurred. */
+ private List<StackTrace> stack = null;
/**
@@ -972,10 +970,6 @@
init(HEADER_SIZE, HEADER_SIZE, 0, 0);
}
}
- // record the stack if info is enabled
- if (logger.isInfoEnabled()) {
- stack = new StackTrace();
- }
}
/**
@@ -1018,10 +1012,6 @@
nrValidItems = p.nrValidItems;
init();
- // record the stack if info is enabled
- if (logger.isInfoEnabled()) {
- stack = new StackTrace();
- }
}
}
@@ -1134,6 +1124,11 @@
++refCount;
+ // record the stack if debug is enabled
+ if (logger.isDebugEnabled()) {
+ stack.add(new StackTrace());
+ }
+
return token;
}
@@ -1225,8 +1220,8 @@
Token token = (tokenRef != null) ? tokenRef.get() : null;
if ( (token == null) && (refCount > 0)) {
- if (logger.isInfoEnabled()) {
- logger.info("Lost phase token.\n" + stack);
+ if (logger.isDebugEnabled()) {
+ logger.info("Lost phase token. Used " + stack.size() + " times:\n" + C.join(stack, "\n\n"));
}
refCount = 0;
}
More information about the Mulgara-svn
mailing list