KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > springframework > scheduling > SchedulingAwareRunnable


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.scheduling;
18
19 /**
20  * Extension of the Runnable interface, adding special callbacks
21  * for long-running operations.
22  *
23  * <p>This interface closely corresponds to the CommonJ Work interface,
24  * but is kept separate to avoid a required CommonJ dependency.
25  *
26  * <p>Scheduling-capable TaskExecutors are encouraged to check a submitted
27  * Runnable, detecting whether this interface is implemented and reacting
28  * as appropriately as they are able to.
29  *
30  * @author Juergen Hoeller
31  * @since 2.0
32  * @see commonj.work.Work
33  * @see org.springframework.core.task.TaskExecutor
34  * @see SchedulingTaskExecutor
35  * @see org.springframework.scheduling.commonj.WorkManagerTaskExecutor
36  */

37 public interface SchedulingAwareRunnable extends Runnable JavaDoc {
38
39     /**
40      * Return whether the Runnable's operation is long-lived
41      * (<code>true</code>) versus short-lived (<code>false</code>).
42      * <p>In the former case, the task will not allocate a thread from the thread
43      * pool (if any) but rather be considered as long-running background thread.
44      * <p>This should be considered a hint. Of course TaskExecutor implementations
45      * are free to ignore this flag and the SchedulingAwareRunnable interface overall.
46      */

47     boolean isLongLived();
48
49 }
50
Popular Tags