Task

From Resin 3.0

Revision as of 14:03, 21 December 2005 by Ferg (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search


Applications which need to launch a configuration thread at initialization time to handle slow or long-lived initialization and allow the configuration to continue can use the TaskResource.

Note, the TaskResource is not appropriate for launching an indefinitely-lived thread, since the thread will not be closed automatically on web-app restart.

Configuring a Task Resource

The application's resource must implement java.lang.Runnable.

resin-web.xml

<resource type="com.caucho.resources.TaskResource">
  <init>
    <work resin:type="com.foo.MyInitializationRunnable"/>
  </init>
</resource>


As with other resources, bean-style (Inversion of Control) initialization of the MyInitializationThread class can be placed inside the <work> tag.

Personal tools