## org.jvnet.hudson.reactor
Class Reactor

    java.lang.Object
      org.jvnet.hudson.reactor.Reactor

All Implemented Interfaces:
  java.lang.Iterable<org.jvnet.hudson.reactor.Reactor.Node>

    public class Reactor

extends java.lang.Object
implements java.lang.Iterable<org.jvnet.hudson.reactor.Reactor.Node>

Executes a set of `Task`s that dependend on each other.

As a `Set`, this object represents a read-only view of all `Task`s.

Author:
  Kohsuke Kawaguchi

Constructor Summary
`Reactor(java.util.Collection<? extends TaskBuilder> builders)`
`Reactor(TaskBuilder... builders)`

Method Summary
`void` `add(Task t)` Adds a new `Task` to the reactor.
`void` `addAll(java.lang.Iterable<? extends Task> _tasks)` Adds a set of taks to the reactor.
`void` `execute(java.util.concurrent.Executor e)`
`void` `execute(java.util.concurrent.Executor e, ReactorListener listener)` Executes this initialization session with the given executor.
`java.util.Iterator<org.jvnet.hudson.reactor.Reactor.Node>` `iterator()`
`protected void` `runTask(Task t)` Can be overridden by the subtype to enclose the entire execution of the task.
`int` `size()`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### Reactor

    public Reactor(java.util.Collection<? extends TaskBuilder> builders)
            throws java.io.IOException

Throws:
  `java.io.IOException`

### Reactor

    public Reactor(TaskBuilder... builders)
            throws java.io.IOException

Throws:
  `java.io.IOException`

Method Detail

### iterator

    public java.util.Iterator<org.jvnet.hudson.reactor.Reactor.Node> iterator()

  Specified by:
    `iterator` in interface `java.lang.Iterable<org.jvnet.hudson.reactor.Reactor.Node>`

### size

    public int size()

### execute

    public void execute(java.util.concurrent.Executor e)
                 throws java.lang.InterruptedException,
                        ReactorException

  Throws:
    `java.lang.InterruptedException`
    `ReactorException`

### add

    public void add(Task t)

  Adds a new `Task` to the reactor.

  This can be even invoked during execution.

### addAll

    public void addAll(java.lang.Iterable<? extends Task> _tasks)

  Adds a set of taks to the reactor.

  When adding a series of related tasks, it's often necessary to add them as a bulk, or else the newly added task can start executing before its dependencies are added.

### execute

    public void execute(java.util.concurrent.Executor e,
                        ReactorListener listener)
                 throws java.lang.InterruptedException,
                        ReactorException

  Executes this initialization session with the given executor.

  Parameters:
    `e` - Used for executing `Task`s.
    `listener` - Receives callbacks during the execution.
  Throws:
    `java.lang.InterruptedException` - if this thread is interrupted while waiting for the execution of tasks to complete.
    `ReactorException` - if one of the tasks failed by throwing an exception. The caller is responsible for canceling existing `Task`s that are in progress in `Executor`, if that's desired.

### runTask

    protected void runTask(Task t)
                    throws java.lang.Exception

  Can be overridden by the subtype to enclose the entire execution of the task.

  Throws:
    `java.lang.Exception`

Copyright © 2011. All Rights Reserved.