src/share/classes/java/util/concurrent/RecursiveAction.java

Print this page




 142  *          sum += right.result;
 143  *        }
 144  *        right = right.next;
 145  *      }
 146  *     result = sum;
 147  *   }
 148  * }}</pre>
 149  *
 150  * @since 1.7
 151  * @author Doug Lea
 152  */
 153 public abstract class RecursiveAction extends ForkJoinTask<Void> {
 154     private static final long serialVersionUID = 5232453952276485070L;
 155 
 156     /**
 157      * The main computation performed by this task.
 158      */
 159     protected abstract void compute();
 160 
 161     /**
 162      * Always returns null.


 163      */
 164     public final Void getRawResult() { return null; }
 165 
 166     /**
 167      * Requires null completion value.
 168      */
 169     protected final void setRawResult(Void mustBeNull) { }
 170 
 171     /**
 172      * Implements execution conventions for RecursiveActions.
 173      */
 174     protected final boolean exec() {
 175         compute();
 176         return true;
 177     }
 178 
 179 }


 142  *          sum += right.result;
 143  *        }
 144  *        right = right.next;
 145  *      }
 146  *     result = sum;
 147  *   }
 148  * }}</pre>
 149  *
 150  * @since 1.7
 151  * @author Doug Lea
 152  */
 153 public abstract class RecursiveAction extends ForkJoinTask<Void> {
 154     private static final long serialVersionUID = 5232453952276485070L;
 155 
 156     /**
 157      * The main computation performed by this task.
 158      */
 159     protected abstract void compute();
 160 
 161     /**
 162      * Always returns {@code null}.
 163      *
 164      * @return {@code null} always
 165      */
 166     public final Void getRawResult() { return null; }
 167 
 168     /**
 169      * Requires null completion value.
 170      */
 171     protected final void setRawResult(Void mustBeNull) { }
 172 
 173     /**
 174      * Implements execution conventions for RecursiveActions.
 175      */
 176     protected final boolean exec() {
 177         compute();
 178         return true;
 179     }
 180 
 181 }