KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > proactive > core > body > request > RequestQueue


1 /*
2 * ################################################################
3 *
4 * ProActive: The Java(TM) library for Parallel, Distributed,
5 * Concurrent computing with Security and Mobility
6 *
7 * Copyright (C) 1997-2002 INRIA/University of Nice-Sophia Antipolis
8 * Contact: proactive-support@inria.fr
9 *
10 * This library is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU Lesser General Public
12 * License as published by the Free Software Foundation; either
13 * version 2.1 of the License, or any later version.
14 *
15 * This library is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 * Lesser General Public License for more details.
19 *
20 * You should have received a copy of the GNU Lesser General Public
21 * License along with this library; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
23 * USA
24 *
25 * Initial developer(s): The ProActive Team
26 * http://www.inria.fr/oasis/ProActive/contacts.html
27 * Contributor(s):
28 *
29 * ################################################################
30 */

31 package org.objectweb.proactive.core.body.request;
32
33 import org.objectweb.proactive.Body;
34 import org.objectweb.proactive.core.event.RequestQueueEventListener;
35
36 public interface RequestQueue {
37
38   /**
39    * Returns an iterator over all the requests in the request queue. It is up to the programmer
40    * to protect himself against any change in the request queue while using this iterator.
41    */

42   public java.util.Iterator JavaDoc iterator();
43
44   public boolean isEmpty();
45
46   public int size();
47
48   public boolean hasRequest(String JavaDoc s);
49
50   public void clear();
51
52   /**
53    * Returns the oldest request from the queue or null if the queue is empty
54    * Do not remove it from the queue
55    * @return the oldest request or null
56    */

57   public Request getOldest();
58
59   /**
60    * Returns the oldest request whose method name is s or null if no match
61    * Do not remove it from the queue
62    * @param methodName the name of the method to look for
63    * @return the oldest matching request or null
64    */

65   public Request getOldest(String JavaDoc methodName);
66
67   /**
68    * Returns the oldest request that matches the criteria defined by the given filter
69    * Do not remove it from the request line
70    * @param requestFilter the filter accepting request on a given criteria
71    * @return the oldest matching request or null
72    */

73   public Request getOldest(RequestFilter requestFilter);
74
75   /**
76    * Removes the oldest request from the queue and returns it
77    * Null is returned is the queue is empty
78    * @return the oldest request or null
79    */

80   public Request removeOldest();
81
82   /**
83    * Removes the oldest request whose method name is s and returns it.
84    * Null is returned is no match
85    * @param methodName the name of the method to look for
86    * @return the oldest matching request or null
87    */

88   public Request removeOldest(String JavaDoc methodName);
89
90   /**
91    * Removes the oldest request that matches the criteria defined by the given filter
92    * Null is returned is no match
93    * @param requestFilter the filter accepting request on a given criteria
94    * @return the oldest matching request or null
95    */

96   public Request removeOldest(RequestFilter requestFilter);
97
98   /**
99    * Returns the youngest request from the queue or null if the queue is empty
100    * Do not remove it from the request line
101    * @return the youngest request or null
102    */

103   public Request getYoungest();
104
105   /**
106    * Returns the youngest request whose method name is s or null if no match
107    * Do not remove it from the request line
108    * @param methodName the name of the method to look for
109    * @return the youngest matching request or null
110    */

111   public Request getYoungest(String JavaDoc methodName);
112
113   /**
114    * Returns the youngest request that matches the criteria defined by the given filter
115    * Do not remove it from the request line
116    * @param requestFilter the filter accepting request on a given criteria
117    * @return the youngest matching request or null
118    */

119   public Request getYoungest(RequestFilter requestFilter);
120
121   /**
122    * Removes the youngest request from the queue and returns it
123    * Null is returned is the queue is empty
124    * @return the youngest request or null
125    */

126   public Request removeYoungest();
127
128   /**
129    * Removes the youngest request whose method name is s and returns it.
130    * Null is returned is no match
131    * @param methodName the name of the method to look for
132    * @return the youngest matching request or null
133    */

134   public Request removeYoungest(String JavaDoc methodName);
135
136   /**
137    * Removes the youngest request that matches the criteria defined by the given filter
138    * Null is returned is no match
139    * @param requestFilter the filter accepting request on a given criteria
140    * @return the youngest matching request or null
141    */

142   public Request removeYoungest(RequestFilter requestFilter);
143
144   /**
145    * Adds the given request to the end of the queue
146    * @param request the request to add
147    */

148   public void add(Request request);
149
150   /**
151    * Adds the given request to the front of the queue before all
152    * other request already in the queue
153    * @param request the request to add
154    */

155   public void addToFront(Request request);
156
157   /**
158    * Processes all requests in the queue using the given RequestProcessor.
159    * Requests are removed from the queue and served depending on the result returned
160    * by the processor
161    * @param processor the RequestProcessor to use
162    * @param body the body that processes the requests
163    */

164   public void processRequests(RequestProcessor processor, Body body);
165
166   public void addRequestQueueEventListener(RequestQueueEventListener listener);
167
168   public void removeRequestQueueEventListener(RequestQueueEventListener listener);
169 }
Popular Tags