org.apache.commons.jelly.tags.threads
Class ThreadTag

java.lang.Object
  extended byorg.apache.commons.jelly.TagSupport
      extended byorg.apache.commons.jelly.tags.threads.ThreadTag
All Implemented Interfaces:
org.apache.commons.jelly.Tag

public class ThreadTag
extends org.apache.commons.jelly.TagSupport

A tag that spawns the contained script in a separate thread. A thread can wait on another thread or another thread group to finish before starting.

Author:
Vinay Chandran, Jason Horman

Field Summary
private  boolean closeOutput
          Should we close the underlying output
private  boolean daemon
          Set if the thread should be a daemon or not
private static org.apache.commons.logging.Log log
          The Log to which logging calls will be made.
private  java.lang.String name
          Thread Name
private  boolean newContext
          Should a new context be created
private  int priority
          Thread priority, defaults to Thread.NORM_PRIORITY
private  JellyThread thread
          Keep a reference to the thread
private static int threadNumber
          The current thread number.
private  java.lang.String var
          Variable to place the thread into
private  org.apache.commons.jelly.XMLOutput xmlOutput
          the destination of output
 
Fields inherited from class org.apache.commons.jelly.TagSupport
body, context, hasTrimmed, parent, shouldTrim
 
Constructor Summary
ThreadTag()
           
ThreadTag(boolean shouldTrim)
           
 
Method Summary
 void doTag(org.apache.commons.jelly.XMLOutput output)
           
 java.lang.Thread getThread()
          Get the thread instance
 void setDaemon(boolean daemon)
          Sets the thread to be a daemon thread if true
 void setFile(java.lang.String name)
          Set the file which is generated from the output
 void setName(java.lang.String name)
          Sets the name of the thread.
 void setNewContext(boolean newContext)
          Should a new context be created for this thread?
 void setPriority(int priority)
          Set the threads priority.
 void setVar(java.lang.String var)
          Sets the variable name to export, optional
 void setXmlOutput(org.apache.commons.jelly.XMLOutput xmlOutput)
          Sets the destination of output
 
Methods inherited from class org.apache.commons.jelly.TagSupport
findAncestorWithClass, findAncestorWithClass, findAncestorWithClass, findAncestorWithClass, findAncestorWithClass, findAncestorWithClass, getBody, getBodyText, getBodyText, getContext, getParent, invokeBody, isTrim, setBody, setContext, setParent, setTrim, trimBody
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

private static final org.apache.commons.logging.Log log
The Log to which logging calls will be made.


threadNumber

private static int threadNumber
The current thread number. Used for default thread naming


var

private java.lang.String var
Variable to place the thread into


name

private java.lang.String name
Thread Name


priority

private int priority
Thread priority, defaults to Thread.NORM_PRIORITY


daemon

private boolean daemon
Set if the thread should be a daemon or not


xmlOutput

private org.apache.commons.jelly.XMLOutput xmlOutput
the destination of output


closeOutput

private boolean closeOutput
Should we close the underlying output


newContext

private boolean newContext
Should a new context be created


thread

private JellyThread thread
Keep a reference to the thread

Constructor Detail

ThreadTag

public ThreadTag()

ThreadTag

public ThreadTag(boolean shouldTrim)
Method Detail

doTag

public void doTag(org.apache.commons.jelly.XMLOutput output)
           throws org.apache.commons.jelly.JellyTagException
Throws:
org.apache.commons.jelly.JellyTagException

setVar

public void setVar(java.lang.String var)
Sets the variable name to export, optional

Parameters:
var - The variable name

setName

public void setName(java.lang.String name)
Sets the name of the thread.

Parameters:
name - The name to set

setPriority

public void setPriority(int priority)
Set the threads priority. Defaults to Thread.NORM_PRIORITY


setDaemon

public void setDaemon(boolean daemon)
Sets the thread to be a daemon thread if true


setXmlOutput

public void setXmlOutput(org.apache.commons.jelly.XMLOutput xmlOutput)
Sets the destination of output


setFile

public void setFile(java.lang.String name)
             throws java.io.IOException
Set the file which is generated from the output

Parameters:
name - The output file name
Throws:
java.io.IOException

setNewContext

public void setNewContext(boolean newContext)
Should a new context be created for this thread?


getThread

public java.lang.Thread getThread()
Get the thread instance

Returns:
The thread