Task

From Resin 3.0

(Difference between revisions)
Jump to: navigation, search
m (Task Resource moved to Task)
(renamed tag to directive)
 
Line 17: Line 17:
  
  
As with other resources, bean-style ([[Inversion of Control]]) initialization of the MyInitializationThread class can be placed inside the <work> tag.
+
As with other resources, bean-style ([[Inversion of Control]]) initialization of the MyInitializationThread class can be placed inside the <work> directive.

Latest revision as of 20:23, 21 February 2006


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