1 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
3 <xsd:schema xmlns="http://www.springframework.org/schema/task"
4 xmlns:xsd="http://www.w3.org/2001/XMLSchema"
5 xmlns:beans="http://www.springframework.org/schema/beans"
6 xmlns:tool="http://www.springframework.org/schema/tool"
7 targetNamespace="http://www.springframework.org/schema/task"
8 elementFormDefault="qualified"
9 attributeFormDefault="unqualified">
12 <xsd:documentation><![CDATA[
13 Defines the elements used in the Spring Framework's support for task execution and scheduling.
14 ]]></xsd:documentation>
17 <xsd:import namespace="http://www.springframework.org/schema/beans" schemaLocation="http://www.springframework.org/schema/beans/spring-beans-3.1.xsd"/>
18 <xsd:import namespace="http://www.springframework.org/schema/tool" schemaLocation="http://www.springframework.org/schema/tool/spring-tool-3.1.xsd"/>
20 <xsd:element name="annotation-driven">
22 <xsd:documentation><![CDATA[
23 Enables the detection of @Async and @Scheduled annotations on any Spring-managed
24 object. If present, a proxy will be generated for executing the annotated methods
27 See Javadoc for the org.springframework.scheduling.annotation.EnableAsync and
28 org.springframework.scheduling.annotation.EnableScheduling annotations for information
29 on code-based alternatives to this XML element.
30 ]]></xsd:documentation>
33 <xsd:attribute name="executor" type="xsd:string" use="optional">
35 <xsd:documentation><![CDATA[
36 Specifies the java.util.Executor instance to use when invoking asynchronous methods.
37 If not provided, an instance of org.springframework.core.task.SimpleAsyncTaskExecutor
38 will be used by default.
39 Note that as of Spring 3.1.2, individual @Async methods may qualify which executor to
40 use, meaning that the executor specified here acts as a default for all non-qualified
42 ]]></xsd:documentation>
45 <xsd:attribute name="scheduler" type="xsd:string" use="optional">
47 <xsd:documentation><![CDATA[
48 Specifies the org.springframework.scheduling.TaskScheduler or
49 java.util.ScheduledExecutorService instance to use when invoking scheduled
50 methods. If no reference is provided, a TaskScheduler backed by a single
51 thread scheduled executor will be used.
52 ]]></xsd:documentation>
58 <xsd:element name="scheduler">
60 <xsd:documentation><![CDATA[
61 Defines a ThreadPoolTaskScheduler instance with configurable pool size. See Javadoc
62 for the org.springframework.scheduling.annotation.EnableScheduling annotation for
63 information on a code-based alternative to this XML element.
64 ]]></xsd:documentation>
67 <xsd:attribute name="id" type="xsd:string" use="required">
69 <xsd:documentation><![CDATA[
70 The bean name for the generated ThreadPoolTaskScheduler instance.
71 It will also be used as the default thread name prefix.
72 ]]></xsd:documentation>
75 <xsd:attribute name="pool-size" type="xsd:string" use="optional">
77 <xsd:documentation><![CDATA[
78 The size of the ScheduledExecutorService's thread pool. The default is 1.
79 ]]></xsd:documentation>
85 <xsd:element name="executor">
87 <xsd:documentation><![CDATA[
88 Defines a ThreadPoolTaskExecutor instance with configurable pool size,
89 queue-capacity, keep-alive, and rejection-policy values.
91 See Javadoc for the org.springframework.scheduling.annotation.EnableAsync annotation
92 for information on code-based alternatives to this XML element.
93 ]]></xsd:documentation>
96 <xsd:attribute name="id" type="xsd:string" use="required">
98 <xsd:documentation><![CDATA[
99 The bean name for the generated ThreadPoolTaskExecutor instance.
100 This value will also be used as the thread name prefix which is why it is
101 required even when defining the executor as an inner bean: The executor
102 won't be directly accessible then but will nevertheless use the specified
103 id as the thread name prefix of the threads that it manages.
104 In the case of multiple task:executors, as of Spring 3.1.2 this value may be used to
105 qualify which executor should handle a given @Async method, e.g. @Async("executorId").
106 See the Javadoc for the #value attribute of Spring's @Async annotation for details.
107 ]]></xsd:documentation>
110 <xsd:attribute name="pool-size" type="xsd:string" use="optional">
112 <xsd:documentation><![CDATA[
113 The size of the executor's thread pool as either a single value or a range
114 (e.g. 5-10). If no bounded queue-capacity value is provided, then a max value
115 has no effect unless the range is specified as 0-n. In that case, the core pool
116 will have a size of n, but the 'allowCoreThreadTimeout' flag will be set to true.
117 If a queue-capacity is provided, then the lower bound of a range will map to the
118 core size and the upper bound will map to the max size. If this attribute is not
119 provided, the default core size will be 1, and the default max size will be
120 Integer.MAX_VALUE (i.e. unbounded).
121 ]]></xsd:documentation>
124 <xsd:attribute name="queue-capacity" type="xsd:string" use="optional">
126 <xsd:documentation><![CDATA[
127 Queue capacity for the ThreadPoolTaskExecutor. If not specified, the default will
128 be Integer.MAX_VALUE (i.e. unbounded).
129 ]]></xsd:documentation>
132 <xsd:attribute name="keep-alive" type="xsd:string" use="optional">
134 <xsd:documentation><![CDATA[
135 Keep-alive time in seconds. Inactive threads that have been created beyond the
136 core size will timeout after the specified number of seconds elapse. If the
137 executor has an unbounded queue capacity and a size range represented as 0-n,
138 then the core threads will also be configured to timeout when inactive.
139 Otherwise, core threads will not ever timeout.
140 ]]></xsd:documentation>
143 <xsd:attribute name="rejection-policy" use="optional">
145 <xsd:documentation><![CDATA[
146 The RejectedExecutionHandler type. When a bounded queue cannot accept any
147 additional tasks, this determines the behavior. While the default is ABORT,
148 consider using CALLER_RUNS to throttle inbound tasks. In other words, by forcing
149 the caller to run the task itself, it will not be able to provide another task
150 until after it completes the task at hand. In the meantime, one or more tasks
151 may be removed from the queue. Alternatively, if it is not critical to run every
152 task, consider using DISCARD to drop the current task or DISCARD_OLDEST to drop
153 the task at the head of the queue.
154 ]]></xsd:documentation>
157 <xsd:restriction base="xsd:string">
158 <xsd:enumeration value="ABORT"/>
159 <xsd:enumeration value="CALLER_RUNS"/>
160 <xsd:enumeration value="DISCARD"/>
161 <xsd:enumeration value="DISCARD_OLDEST"/>
168 <xsd:element name="scheduled-tasks">
170 <xsd:documentation><![CDATA[
171 Top-level element that contains one or more task sub-elements to be
172 managed by a given TaskScheduler.
173 ]]></xsd:documentation>
177 <xsd:element name="scheduled" type="scheduledTaskType" minOccurs="1" maxOccurs="unbounded"/>
179 <xsd:attribute name="scheduler" type="xsd:string" use="optional">
181 <xsd:documentation><![CDATA[
182 Reference to an instance of TaskScheduler to manage the provided tasks. If not specified,
183 the default value will be a wrapper for a single-threaded Executor.
184 ]]></xsd:documentation>
186 <tool:annotation kind="ref">
187 <tool:expected-type type="org.springframework.scheduling.TaskScheduler"/>
195 <xsd:complexType name="scheduledTaskType">
197 <xsd:documentation><![CDATA[
198 Element defining a scheduled method-invoking task and its corresponding trigger.
199 ]]></xsd:documentation>
201 <xsd:attribute name="cron" type="xsd:string" use="optional">
203 <xsd:documentation><![CDATA[
204 A cron-based trigger. See the org.springframework.scheduling.support.CronSequenceGenerator
205 JavaDoc for example patterns.
206 ]]></xsd:documentation>
209 <xsd:attribute name="fixed-delay" type="xsd:string" use="optional">
211 <xsd:documentation><![CDATA[
212 An interval-based trigger where the interval is measured from the completion time of the
213 previous task. The time unit value is measured in milliseconds.
214 ]]></xsd:documentation>
217 <xsd:attribute name="fixed-rate" type="xsd:string" use="optional">
219 <xsd:documentation><![CDATA[
220 An interval-based trigger where the interval is measured from the start time of the
221 previous task. The time unit value is measured in milliseconds.
222 ]]></xsd:documentation>
225 <xsd:attribute name="trigger" type="xsd:string" use="optional">
227 <xsd:documentation><![CDATA[
228 A reference to a bean that implements the Trigger interface.
229 ]]></xsd:documentation>
232 <xsd:attribute name="ref" type="xsd:string" use="required">
234 <xsd:documentation><![CDATA[
235 Reference to an object that provides a method to be invoked.
236 ]]></xsd:documentation>
238 <tool:annotation kind="ref" />
242 <xsd:attribute name="method" type="xsd:string" use="required">
244 <xsd:documentation><![CDATA[
245 The name of the method to be invoked.
246 ]]></xsd:documentation>
249 <tool:expected-method type-ref="@ref"/>