KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > springframework > core > task > TaskExecutor


1 /*
2  * Copyright 2002-2006 the original author or authors.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16
17 package org.springframework.core.task;
18
19 /**
20  * Simple task executor interface that abstracts the execution
21  * of a {@link Runnable}.
22  *
23  * <p>Implementations can use all sorts of different execution strategies,
24  * such as: synchronous, asynchronous, using a thread pool, and more.
25  *
26  * <p>Equivalent to JDK 1.5's {@link java.util.concurrent.Executor}
27  * interface. Separate mainly for compatibility with JDK 1.3+.
28  * Implementations can simply implement the JDK 1.5 <code>Executor</code>
29  * interface as well, as it defines the exact same method signature.
30  *
31  * @author Juergen Hoeller
32  * @since 2.0
33  * @see java.util.concurrent.Executor
34  */

35 public interface TaskExecutor {
36
37     /**
38      * Execute the given <code>task</code>.
39      * <p>The call might return immediately if the implementation uses
40      * an asynchronous execution strategy, or might block in the case
41      * of synchronous execution.
42      * @param task the <code>Runnable</code> to execute (never <code>null</code>)
43      * @throws TaskRejectedException if the given task was not accepted
44      */

45     void execute(Runnable JavaDoc task);
46
47 }
48
Popular Tags