KickJava   Java API By Example, From Geeks To Geeks.

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


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 public interface BlockingRequestQueue extends RequestQueue {
34     //
35
// -- PUBLIC METHODS -----------------------------------------------
36
//
37

38     /**
39    * Destroys this BlockingQueue by removing all its content, unblocking all thread
40    * waiting for a request and making sure that no thread will block again.
41    * After this call, any call to a blocking method won't block and return null.
42    */

43     public void destroy();
44
45     /**
46    * Returns if this BlockingQueue is destroyed
47    */

48     public boolean isDestroyed();
49
50     /**
51    * Blocks the calling thread until there is a request that can be accepted
52    * be the given RequestFilter.
53    * Returns immediately if there is already one. The request returned is non
54    * null unless the thread has been asked not to wait anymore.
55    * @param requestFilter the request filter that select the request to be returned
56    * @return the oldest request found in the queue that is accepted by the filter.
57    */

58     public Request blockingRemoveOldest(RequestFilter requestFilter);
59
60     /**
61    * Blocks the calling thread until there is a request of name methodName
62    * Returns immediately if there is already one. The request returned is non
63    * null unless the thread has been asked not to wait anymore.
64    * @param methodName the name of the method to wait for
65    * @return the oldest request of name methodName found in the queue.
66    */

67     public Request blockingRemoveOldest(String JavaDoc methodName);
68
69     /**
70    * Blocks the calling thread until there is a request available
71    * Returns immediately if there is already one. The request returned is non
72    * null unless the thread has been asked not to wait anymore.
73    * @return the oldest request found in the queue.
74    */

75     public Request blockingRemoveOldest();
76
77     /**
78    * Blocks the calling thread until there is a request available but try
79    * to limit the time the thread is blocked to timeout.
80    * Returns immediately if there is already one. The request returned is non
81    * null if a request has been found during the given time.
82    * @return the oldest request found in the queue or null.
83    */

84     public Request blockingRemoveOldest(long timeout);
85
86     /**
87    * Blocks the calling thread until there is a request that can be accepted
88    * be the given RequestFilter.
89    * Returns immediately if there is already one. The request returned is non
90    * null unless the thread has been asked not to wait anymore.
91    * @param requestFilter the request filter that select the request to be returned
92    * @return the youngest request found in the queue that is accepted by the filter.
93    */

94     public Request blockingRemoveYoungest(RequestFilter requestFilter);
95
96     /**
97    * Blocks the calling thread until there is a request of name methodName
98    * Returns immediately if there is already one. The request returned is non
99    * null unless the thread has been asked not to wait anymore.
100    * @param methodName the name of the method to wait for
101    * @return the youngest request of name methodName found in the queue.
102    */

103     public Request blockingRemoveYoungest(String JavaDoc methodName);
104
105     /**
106    * Blocks the calling thread until there is a request available
107    * Returns immediately if there is already one. The request returned is non
108    * null unless the thread has been asked not to wait anymore.
109    * @return the youngest request found in the queue.
110    */

111     public Request blockingRemoveYoungest();
112
113     /**
114    * Blocks the calling thread until there is a request available but try
115    * to limit the time the thread is blocked to timeout.
116    * Returns immediately if there is already one. The request returned is non
117    * null if a request has been found during the given time.
118    * @return the youngest request found in the queue or null.
119    */

120     public Request blockingRemoveYoungest(long timeout);
121
122     /**
123    * Blocks the calling thread until there is a request available. The request
124    * is not removed from the queue.
125    * Returns immediately if there is already one.
126    */

127     public void waitForRequest();
128 }
Popular Tags