commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kohs...@apache.org
Subject svn commit: r226309 - /jakarta/commons/sandbox/javaflow/trunk/src/java/org/apache/commons/javaflow/Continuation.java
Date Fri, 29 Jul 2005 00:25:51 GMT
Author: kohsuke
Date: Thu Jul 28 17:25:48 2005
New Revision: 226309

URL: http://svn.apache.org/viewcvs?rev=226309&view=rev
Log:
- modified to return null from the continueWith method when there is nothing to continue
- javadoc improvement on the getContext method
- signature improvement on the getContext method

Modified:
    jakarta/commons/sandbox/javaflow/trunk/src/java/org/apache/commons/javaflow/Continuation.java

Modified: jakarta/commons/sandbox/javaflow/trunk/src/java/org/apache/commons/javaflow/Continuation.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/javaflow/trunk/src/java/org/apache/commons/javaflow/Continuation.java?rev=226309&r1=226308&r2=226309&view=diff
==============================================================================
--- jakarta/commons/sandbox/javaflow/trunk/src/java/org/apache/commons/javaflow/Continuation.java
(original)
+++ jakarta/commons/sandbox/javaflow/trunk/src/java/org/apache/commons/javaflow/Continuation.java
Thu Jul 28 17:25:48 2005
@@ -37,7 +37,7 @@
     private final static Log log = LogFactory.getLog(Continuation.class);
     
     private final static transient Map continuationsMap = new HashMap();
-    private transient Object context;
+    private transient ContinuationContext context;
 
     private transient boolean restoring = false;
     private transient boolean capturing = false;
@@ -68,12 +68,17 @@
 
 
     /**
-     * get the current contex. only valid
-     * while calling "continueWith"
-     * 
-     * @return context object
+     * get the current context.
+     *
+     * <p>
+     * This method returns the same context object given to {@link #startWith(String, ContinuationContext)}
+     * or {@link #continueWith(Continuation, ContinuationContext)}.
+     *
+     * @return
+     *      null if this method is invoked outside {@link #startWith(String, ContinuationContext)}
+     *      or {@link #continueWith(Continuation, ContinuationContext)} .
      */
-    public Object getContext() {
+    public ContinuationContext getContext() {
         return context;
     }
     
@@ -109,6 +114,7 @@
     }
 
     private static Continuation execute(final Continuation continuation, final ContinuationContext
context) {
+        boolean completed = false;
         try {
             continuation.registerThread();
             
@@ -144,6 +150,8 @@
                 if (continuation.stack.hasReference()) {
                     continuation.stack.popReference();
                 }
+            } else {
+                completed = true;
             }
 
             continuation.context = null;
@@ -151,7 +159,11 @@
             continuation.deregisterThread();
         }
 
-        return continuation;        
+        if(completed) {
+            return null;
+        } else {
+            return continuation;
+        }
     }
     
     /**



---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message