next up previous
Next: Modification of the Method Up: Actual Parallelization Previous: Actual Parallelization

Construction of the Tree-Worker Class

  In the first step, a sub-class TreeWorker_x of java.lang.Thread is constructed that provides an implementation of a tree-worker that can be used specifically to execute invocations of the final method myMethod() in parallel. Consequently, if a Java program contains m parallel multi-way methods, then m classes are constructed and added to the transformed Java program, as is illustrated in figure 6.

   figure1340
Figure 6: Class Hierarchy

An instance variable result can be used to transfer the result of a method invocation. Instance variable depth will be used to record the current depth in the method invocation tree.

For each formal argument fi of myMethod(), there is an instance variable fi_x of the appropriate type. An instance variable target is possibly used to store a target. Finally, a constructor that initializes a new tree-worker and a run()-method that calls a new method myMethod_par_x() with the appropriate parameters are provided:

tabular426

Constructs involving target are only required if myMethod() is an instance method. For a class method, these constructs are omitted and `MyClass' is used in the call to myMethod_par_x() instead. If myMethod() is a void-method, all constructs involving result are omitted.



ajcbik@extreme.indiana.edu