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.0.xsd"/>
18 <xsd:import namespace="http://www.springframework.org/schema/tool" schemaLocation="http://www.springframework.org/schema/tool/spring-tool-3.0.xsd"/>
20 <xsd:element name="annotation-driven">
22 <xsd:documentation><![CDATA[
23 Enables the detection of @Async and @Scheduled annotations on any Spring-managed object. If present,
24 a proxy will be generated for executing the annotated methods asynchronously.
25 ]]></xsd:documentation>
28 <xsd:attribute name="executor" type="xsd:string" use="optional">
30 <xsd:documentation><![CDATA[
31 Specifies the java.util.Executor instance to use when invoking asynchronous methods.
32 If not provided, an instance of org.springframework.core.task.SimpleAsyncTaskExecutor
33 will be used by default.
34 ]]></xsd:documentation>
37 <xsd:attribute name="scheduler" type="xsd:string" use="optional">
39 <xsd:documentation><![CDATA[
40 Specifies the org.springframework.scheduling.TaskScheduler or
41 java.util.ScheduledExecutorService instance to use when invoking scheduled
42 methods. If no reference is provided, a TaskScheduler backed by a single
43 thread scheduled executor will be used.
44 ]]></xsd:documentation>
47 <xsd:attribute name="mode" default="proxy">
49 <xsd:documentation><![CDATA[
50 Should annotated beans be proxied using Spring's AOP framework,
51 or should they rather be weaved with an AspectJ async execution aspect?
53 AspectJ weaving requires spring-aspects.jar on the classpath,
54 as well as load-time weaving (or compile-time weaving) enabled.
56 Note: The weaving-based aspect requires the @Async annotation to be
57 defined on the concrete class. Annotations in interfaces will not work
58 in that case (they will rather only work with interface-based proxies)!
59 ]]></xsd:documentation>
62 <xsd:restriction base="xsd:string">
63 <xsd:enumeration value="proxy"/>
64 <xsd:enumeration value="aspectj"/>
68 <xsd:attribute name="proxy-target-class" type="xsd:boolean" default="false">
70 <xsd:documentation><![CDATA[
71 Are class-based (CGLIB) proxies to be created? By default, standard
72 Java interface-based proxies are created.
74 Note: Class-based proxies require the @Async annotation to be defined
75 on the concrete class. Annotations in interfaces will not work in
76 that case (they will rather only work with interface-based proxies)!
77 ]]></xsd:documentation>
83 <xsd:element name="scheduler">
85 <xsd:documentation><![CDATA[
86 Defines a ThreadPoolTaskScheduler instance with configurable pool size.
87 ]]></xsd:documentation>
90 <xsd:attribute name="id" type="xsd:string" use="required">
92 <xsd:documentation><![CDATA[
93 The bean name for the generated ThreadPoolTaskScheduler instance.
94 It will also be used as the default thread name prefix.
95 ]]></xsd:documentation>
98 <xsd:attribute name="pool-size" type="xsd:string" use="optional">
100 <xsd:documentation><![CDATA[
101 The size of the ScheduledExecutorService's thread pool. The default is 1.
102 ]]></xsd:documentation>
108 <xsd:element name="executor">
110 <xsd:documentation><![CDATA[
111 Defines a ThreadPoolTaskExecutor instance with configurable pool size,
112 queue-capacity, keep-alive, and rejection-policy values.
113 ]]></xsd:documentation>
116 <xsd:attribute name="id" type="xsd:string" use="required">
118 <xsd:documentation><![CDATA[
119 The bean name for the generated ThreadPoolTaskExecutor instance.
120 This value will also be used as the thread name prefix which is why it is
121 required even when defining the executor as an inner bean: The executor
122 won't be directly accessible then but will nevertheless use the specified
123 id as the thread name prefix of the threads that it manages.
124 ]]></xsd:documentation>
127 <xsd:attribute name="pool-size" type="xsd:string" use="optional">
129 <xsd:documentation><![CDATA[
130 The size of the executor's thread pool as either a single value or a range
131 (e.g. 5-10). If no bounded queue-capacity value is provided, then a max value
132 has no effect unless the range is specified as 0-n. In that case, the core pool
133 will have a size of n, but the 'allowCoreThreadTimeout' flag will be set to true.
134 If a queue-capacity is provided, then the lower bound of a range will map to the
135 core size and the upper bound will map to the max size. If this attribute is not
136 provided, the default core size will be 1, and the default max size will be
137 Integer.MAX_VALUE (i.e. unbounded).
138 ]]></xsd:documentation>
141 <xsd:attribute name="queue-capacity" type="xsd:string" use="optional">
143 <xsd:documentation><![CDATA[
144 Queue capacity for the ThreadPoolTaskExecutor. If not specified, the default will
145 be Integer.MAX_VALUE (i.e. unbounded).
146 ]]></xsd:documentation>
149 <xsd:attribute name="keep-alive" type="xsd:string" use="optional">
151 <xsd:documentation><![CDATA[
152 Keep-alive time in seconds. Inactive threads that have been created beyond the
153 core size will timeout after the specified number of seconds elapse. If the
154 executor has an unbounded queue capacity and a size range represented as 0-n,
155 then the core threads will also be configured to timeout when inactive.
156 Otherwise, core threads will not ever timeout.
157 ]]></xsd:documentation>
160 <xsd:attribute name="rejection-policy" use="optional">
162 <xsd:documentation><![CDATA[
163 The RejectedExecutionHandler type. When a bounded queue cannot accept any
164 additional tasks, this determines the behavior. While the default is ABORT,
165 consider using CALLER_RUNS to throttle inbound tasks. In other words, by forcing
166 the caller to run the task itself, it will not be able to provide another task
167 until after it completes the task at hand. In the meantime, one or more tasks
168 may be removed from the queue. Alternatively, if it is not critical to run every
169 task, consider using DISCARD to drop the current task or DISCARD_OLDEST to drop
170 the task at the head of the queue.
171 ]]></xsd:documentation>
174 <xsd:restriction base="xsd:string">
175 <xsd:enumeration value="ABORT"/>
176 <xsd:enumeration value="CALLER_RUNS"/>
177 <xsd:enumeration value="DISCARD"/>
178 <xsd:enumeration value="DISCARD_OLDEST"/>
185 <xsd:element name="scheduled-tasks">
187 <xsd:documentation><![CDATA[
188 Top-level element that contains one or more task sub-elements to be
189 managed by a given TaskScheduler.
190 ]]></xsd:documentation>
194 <xsd:element name="scheduled" type="scheduledTaskType" minOccurs="1" maxOccurs="unbounded"/>
196 <xsd:attribute name="scheduler" type="xsd:string" use="optional">
198 <xsd:documentation><![CDATA[
199 Reference to an instance of TaskScheduler to manage the provided tasks. If not specified,
200 the default value will be a wrapper for a single-threaded Executor.
201 ]]></xsd:documentation>
203 <tool:annotation kind="ref">
204 <tool:expected-type type="org.springframework.scheduling.TaskScheduler"/>
212 <xsd:complexType name="scheduledTaskType">
214 <xsd:documentation><![CDATA[
215 Element defining a scheduled method-invoking task and its corresponding trigger.
216 ]]></xsd:documentation>
218 <xsd:attribute name="cron" type="xsd:string" use="optional">
220 <xsd:documentation><![CDATA[
221 A cron-based trigger. See the org.springframework.scheduling.support.CronSequenceGenerator
222 JavaDoc for example patterns.
223 ]]></xsd:documentation>
226 <xsd:attribute name="fixed-delay" type="xsd:string" use="optional">
228 <xsd:documentation><![CDATA[
229 An interval-based trigger where the interval is measured from the completion time of the
230 previous task. The time unit value is measured in milliseconds.
231 ]]></xsd:documentation>
234 <xsd:attribute name="fixed-rate" type="xsd:string" use="optional">
236 <xsd:documentation><![CDATA[
237 An interval-based trigger where the interval is measured from the start time of the
238 previous task. The time unit value is measured in milliseconds.
239 ]]></xsd:documentation>
242 <xsd:attribute name="ref" type="xsd:string" use="required">
244 <xsd:documentation><![CDATA[
245 Reference to an object that provides a method to be invoked.
246 ]]></xsd:documentation>
248 <tool:annotation kind="ref" />
252 <xsd:attribute name="method" type="xsd:string" use="required">
254 <xsd:documentation><![CDATA[
255 The name of the method to be invoked.
256 ]]></xsd:documentation>
259 <tool:expected-method type-ref="@ref"/>