tapestry-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From conflue...@apache.org
Subject [CONF] Apache Tapestry > IoC - parallel
Date Mon, 20 Sep 2010 08:37:02 GMT
    <base href="https://cwiki.apache.org/confluence">
            <link rel="stylesheet" href="/confluence/s/1810/9/12/_/styles/combined.css?spaceKey=TAPESTRY&amp;forWysiwyg=true"
<body style="background: white;" bgcolor="white" class="email-body">
<div id="pageContent">
<div id="notificationFormat">
<div class="wiki-content">
<div class="email">
    <h2><a href="https://cwiki.apache.org/confluence/display/TAPESTRY/IoC+-+parallel">IoC
- parallel</a></h2>
    <h4>Page  <b>added</b> by             <a href="https://cwiki.apache.org/confluence/display/~uli">Ulrich
    <div class="notificationGreySide">
         <h1><a name="IoC-parallel-ParallelExecution"></a>Parallel Execution</h1>

<p>The <span class="error">&#91;ParallelExecutor|../apidocs/org/apache/tapestry5/ioc/services/ParallelExecutor.html&#93;</span>
allows a computation to occur in parallel.</p>

<p>It can be used in two ways. First, with an explicit Future:</p>

<div class="preformatted panel" style="border-width: 1px;"><div class="preformattedContent
<pre>   Future&lt;String&gt; future = executor.invoke(new Invokable&lt;String&gt;()
{ ... });</pre>

<p>The executor will submit the Invokable to a thread pool for execution in the background.</p>

<p>The ultimate value of the Invokable is available from invoking get() on the Future;
this will block until the value is ready.</p>

<p>Other methods on Future can cancel the execution, or get the value only if it is
ready within a timeout.</p>

<p>The thread pool is started automatically as needed, and will shutdown when the Registry
itself is shutdown.</p>

<p>Another alternative will return an object, not a Future:</p>

<div class="preformatted panel" style="border-width: 1px;"><div class="preformattedContent
<pre>  RSSFeed feed = executor.invoke(RSSFeed.class, new Invokable&lt;RSSFeed&gt;()
{ ... });</pre>

<p>This only works if the type is an interface. A proxy for the interface is created
around the Future object; any invocation on the proxy will invoke get() on the Future.</p>

<h1><a name="IoC-parallel-Configuration"></a>Configuration</h1>

<p>Configuraton symbols are defined in <span class="error">&#91;IOCSymbols|../apidocs/org/apache/tapestry5/ioc/IOCSymbols.html&#93;</span>.</p>

<p> tapestry.thread-pool-enabled If "true", the default, then the thread pool will operate.
If "false", then ParallelExecutor's implementation changes to invoke the Invokable immediately,
not in a pooled thread. tapestry.thread-pool.core-pool-size Minimum size of the thread pool.
Defaults to 3. tapestry.thread-pool.max-pool-size Maximum number of threads (active or inactive)
in the thread pool. Defaults to 20. tapestry.thread-pool.keep-alive Time to keep waiting threads
alive. Defaults to "1 m" (one minute). </p>
    <div id="commentsSection" class="wiki-content pageSection">
       <div style="float: right;">
            <a href="https://cwiki.apache.org/confluence/users/viewnotifications.action"
class="grey">Change Notification Preferences</a>
       <a href="https://cwiki.apache.org/confluence/display/TAPESTRY/IoC+-+parallel">View

View raw message