jstrachan    2002/10/08 02:20:10

  Modified:    jelly/src/java/org/apache/commons/jelly/tags/core
                        ThreadTag.java
  Log:
  Patch to use a new child context for the asynchronous execution. 
  Also this ensures that the asynchronous block will definitely contain the correct 
context, irrespectively of what happens to the ThreadTag after it is disposed of after 
evaluation.
  
  
  Revision  Changes    Path
  1.3       +6 -2      
jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/core/ThreadTag.java
  
  Index: ThreadTag.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/core/ThreadTag.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ThreadTag.java    7 Oct 2002 15:02:49 -0000       1.2
  +++ ThreadTag.java    8 Oct 2002 09:20:10 -0000       1.3
  @@ -60,6 +60,7 @@
   import java.io.FileWriter;
   import java.io.IOException;
   
  +import org.apache.commons.jelly.JellyContext;
   import org.apache.commons.jelly.MissingAttributeException;
   import org.apache.commons.jelly.TagSupport;
   import org.apache.commons.jelly.XMLOutput;
  @@ -85,12 +86,15 @@
               // lets default to system.out
               xmlOutput = XMLOutput.createXMLOutput( System.out );
           }
  -        
  +
  +        // lets create a child context
  +        final JellyContext newContext = new JellyContext(context);
  +                
           Thread thread = new Thread(
               new Runnable() {
                   public void run() {
                       try {
  -                        invokeBody(xmlOutput);
  +                        getBody().run(newContext, xmlOutput);
                           xmlOutput.close();
                       }
                       catch (Exception e) {
  
  
  

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to