Package org.apache.tapestry5.ioc.internal.services

# Class ParallelExecutorImpl

java.lang.Object
org.apache.tapestry5.ioc.internal.services.ParallelExecutorImpl

All Implemented Interfaces:
  `ParallelExecutor`

public class ParallelExecutorImpl extends Object implements ParallelExecutor

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `ParallelExecutorImpl(ExecutorService executorService, ThunkCreator thunkCreator, PerthreadManager perthreadManager)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `<T> T`
  `invoke(Class<T> proxyType, Invokable<T> invocable)`
  As with `ParallelExecutor.invoke(org.apache.tapestry5.ioc.Invokable)`, but the result is wrapped inside a thunk.
  `<T> Future<T>`
  `invoke(Invokable<T> invocable)`
  Submits the invocable object to be executed in a pooled thread.

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### ParallelExecutorImpl

    public ParallelExecutorImpl(ExecutorService executorService, ThunkCreator thunkCreator, PerthreadManager perthreadManager)

- ## Method Details

  - ### invoke

    public <T> Future<T> invoke(Invokable<T> invocable)
    Description copied from interface: `ParallelExecutor`
    Submits the invocable object to be executed in a pooled thread. Returns a Future object representing the eventual result of the invocable's operation. The actual operation will be wrapped such that `PerthreadManager.cleanup()` is invoked after the operation completes.
    Specified by:
      `invoke` in interface `ParallelExecutor`
    Parameters:
      `invocable` - to execute in a thread
    Returns:
      Future result of that invocation

  - ### invoke

    public <T> T invoke(Class<T> proxyType, Invokable<T> invocable)
    Description copied from interface: `ParallelExecutor`
    As with `ParallelExecutor.invoke(org.apache.tapestry5.ioc.Invokable)`, but the result is wrapped inside a thunk. Invoking methods on the thunk will block until the value is available.
    Specified by:
      `invoke` in interface `ParallelExecutor`
    Parameters:
      `proxyType` - return type, used to create the thunk
      `invocable` - object that will eventually execute and return a value
    Returns:
      the thunk