You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@labs.apache.org by si...@apache.org on 2009/02/02 04:20:47 UTC

svn commit: r739914 - /labs/magma/trunk/foundation-basics/src/main/java/org/apache/magma/basics/context/RunningContext.java

Author: simoneg
Date: Mon Feb  2 03:20:47 2009
New Revision: 739914

URL: http://svn.apache.org/viewvc?rev=739914&view=rev
Log:
LABS-279 : stupid bug emerged from CI

Modified:
    labs/magma/trunk/foundation-basics/src/main/java/org/apache/magma/basics/context/RunningContext.java

Modified: labs/magma/trunk/foundation-basics/src/main/java/org/apache/magma/basics/context/RunningContext.java
URL: http://svn.apache.org/viewvc/labs/magma/trunk/foundation-basics/src/main/java/org/apache/magma/basics/context/RunningContext.java?rev=739914&r1=739913&r2=739914&view=diff
==============================================================================
--- labs/magma/trunk/foundation-basics/src/main/java/org/apache/magma/basics/context/RunningContext.java (original)
+++ labs/magma/trunk/foundation-basics/src/main/java/org/apache/magma/basics/context/RunningContext.java Mon Feb  2 03:20:47 2009
@@ -49,12 +49,16 @@
 	 * @return The current context
 	 */
 	public static SubRunningContext get() {
+		return getMain().currents.peek();
+	}
+	
+	private static RunningContext getMain() {
 		RunningContext context = runnings.get();
 		if (context == null) {
 			context = new RunningContext();
 			runnings.set(context);
 		}
-		return context.currents.peek();
+		return context;
 	}
 	
 	protected RunningContext() {
@@ -69,7 +73,7 @@
 	 * @param co the context owner we are entering.
 	 */
 	public static void entering(ContextOwner co) {
-		RunningContext context = runnings.get();
+		RunningContext context = getMain();
 		SubRunningContext sr = context.saveds.get(co);
 		if (sr == null) {
 			sr = new SubRunningContext();
@@ -81,12 +85,12 @@
 	}
 	
 	/**
-	 * Extis the snapshot of a {@link ContextOwner}, returning to the previous snapshot if more than one call to
+	 * Exits the snapshot of a {@link ContextOwner}, returning to the previous snapshot if more than one call to
 	 * {@link #entering(ContextOwner)} was made, or to the normal flow.
 	 * @param co The context owner we are exiting, used to check for leaks.
 	 */
 	public static void exiting(ContextOwner co) {
-		RunningContext context = runnings.get();
+		RunningContext context = getMain();
 		SubRunningContext pop = context.currents.pop();
 		if (pop.getOwner() != co) throw new MagmaException("Running context disaligned, expecting {0} but got {1}", co, pop.getOwner());
 	}
@@ -96,7 +100,7 @@
 	 * @param co The context owner we are creating the snapshot for.
 	 */
 	public static void createFor(ContextOwner co) {
-		RunningContext context = runnings.get();
+		RunningContext context = getMain();
 		if (!context.saveds.containsKey(co)) {
 			SubRunningContext sr = new SubRunningContext();
 			sr.addAll(context.currents.peek());



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@labs.apache.org
For additional commands, e-mail: commits-help@labs.apache.org