01: /**
02: * Licensed to the Apache Software Foundation (ASF) under one
03: * or more contributor license agreements. See the NOTICE file
04: * distributed with this work for additional information
05: * regarding copyright ownership. The ASF licenses this file
06: * to you under the Apache License, Version 2.0 (the
07: * "License"); you may not use this file except in compliance
08: * with the License. You may obtain a copy of the License at
09: *
10: * http://www.apache.org/licenses/LICENSE-2.0
11: *
12: * Unless required by applicable law or agreed to in writing,
13: * software distributed under the License is distributed on an
14: * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15: * KIND, either express or implied. See the License for the
16: * specific language governing permissions and limitations
17: * under the License.
18: */package org.apache.cxf.workqueue;
19:
20: import java.util.concurrent.Executor;
21:
22: public interface WorkQueue extends Executor {
23: /**
24: * Submits a work item for execution at some time in the future, waiting for up to a
25: * specified amount of time for the item to be accepted.
26: *
27: * @param work the workitem to submit for execution.
28: * @param timeout the maximum amount of time (in milliseconds) to wait for it to be accepted.
29: *
30: * @throws <code>RejectedExecutionException</code> if this work item cannot be accepted for execution.
31: * @throws <code>NullPointerException</code> if work item is null.
32: */
33: void execute(Runnable work, long timeout);
34:
35: /**
36: * Schedules a work item for execution at some time in the future.
37: *
38: * @param work the task to submit for execution.
39: * @param delay the delay before the task is executed
40: *
41: * @throws <code>RejectedExecutionException</code> if this task cannot be accepted for execution.
42: * @throws <code>NullPointerException</code> if task is null.
43: */
44: void schedule(Runnable work, long delay);
45: }
|