[jboss-cvs] JBossCache/src/org/jboss/cache ...
Manik Surtani
msurtani at jboss.com
Wed Jul 19 14:47:20 EDT 2006
User: msurtani
Date: 06/07/19 14:47:19
Modified: src/org/jboss/cache InvocationContext.java
Log:
Added ThreadLocal container to invocation context object
Revision Changes Path
1.5 +30 -2 JBossCache/src/org/jboss/cache/InvocationContext.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: InvocationContext.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/InvocationContext.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- InvocationContext.java 22 May 2006 16:21:58 -0000 1.4
+++ InvocationContext.java 19 Jul 2006 18:47:19 -0000 1.5
@@ -17,19 +17,47 @@
*/
public class InvocationContext
{
+ private static ThreadLocal<InvocationContext> container = new ThreadLocal<InvocationContext>();
private Transaction transaction;
private GlobalTransaction globalTransaction;
private Option optionOverrides;
// defaults to true.
private boolean originLocal = true;
private boolean txHasMods;
+ private boolean localRollbackOnly;
+
+ /**
+ * @return the current invocation context associated with the current thread.
+ */
+ public static InvocationContext getCurrent()
+ {
+ InvocationContext i = container.get();
+ if (i == null)
+ {
+ i = new InvocationContext();
+ container.set(i);
+ }
+ return i;
+ }
+
+ /**
+ * Associates the given invocation context with the current thread.
+ * @param i
+ */
+ public static void setCurrent(InvocationContext i)
+ {
+ container.set(i);
+ }
+
+ private InvocationContext()
+ {
+ }
public void setLocalRollbackOnly(boolean localRollbackOnly)
{
this.localRollbackOnly = localRollbackOnly;
}
- private boolean localRollbackOnly;
/**
* Retrieves the transaction associated with this invocation
More information about the jboss-cvs-commits
mailing list