Task

From Resin 3.0

(Redirected from Task Resource)
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> directive.

Personal tools