01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: */
17:
18: package org.apache.catalina.tribes.transport;
19:
20: import org.apache.catalina.tribes.io.ListenCallback;
21:
22: /**
23: * @author Filip Hanik
24: * @version $Revision: 487420 $ $Date: 2006-12-15 02:35:06 +0100 (ven., 15 déc. 2006) $
25: */
26: public abstract class AbstractRxTask implements Runnable {
27:
28: public static final int OPTION_DIRECT_BUFFER = ReceiverBase.OPTION_DIRECT_BUFFER;
29:
30: private ListenCallback callback;
31: private RxTaskPool pool;
32: private boolean doRun = true;
33: private int options;
34: protected boolean useBufferPool = true;
35:
36: public AbstractRxTask(ListenCallback callback) {
37: this .callback = callback;
38: }
39:
40: public void setTaskPool(RxTaskPool pool) {
41: this .pool = pool;
42: }
43:
44: public void setOptions(int options) {
45: this .options = options;
46: }
47:
48: public void setCallback(ListenCallback callback) {
49: this .callback = callback;
50: }
51:
52: public void setDoRun(boolean doRun) {
53: this .doRun = doRun;
54: }
55:
56: public RxTaskPool getTaskPool() {
57: return pool;
58: }
59:
60: public int getOptions() {
61: return options;
62: }
63:
64: public ListenCallback getCallback() {
65: return callback;
66: }
67:
68: public boolean isDoRun() {
69: return doRun;
70: }
71:
72: public void close() {
73: doRun = false;
74: notify();
75: }
76:
77: public void setUseBufferPool(boolean usebufpool) {
78: useBufferPool = usebufpool;
79: }
80:
81: public boolean getUseBufferPool() {
82: return useBufferPool;
83: }
84: }
|