KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > net > walend > somnifugi > channel > Takable


1 package net.walend.somnifugi.channel;
2
3 import java.util.Enumeration JavaDoc;
4
5 import net.walend.somnifugi.SomniMessageSelector;
6 import net.walend.somnifugi.SomniMessageSelectorException;
7
8 /**
9 An interface for the head of a Queue.
10
11 @author <a HREF="http://walend.net">David Walend</a> <a HREF="mailto:david@walend.net">david@walend.net</a>
12  */

13
14 public interface Takable<Elem>
15 {
16     /**
17 Retrieves and removes the head of this queue.
18     */

19     public Elem poll();
20
21     /**
22 Retrieves and removes the head of this queue, waiting if necessary up to the specified wait time if no elements are present on this queue.
23     */

24     public Elem poll(long timeout)
25         throws InterruptedException JavaDoc;
26     /**
27 Retrieves and removes the head of this queue, waiting if no elements are present on this queue.
28     */

29     public Elem take()
30         throws InterruptedException JavaDoc;
31
32     /**
33 Pushes an element back onto the head of a queue.
34     */

35     public void pushBack(Elem elem)
36         throws InterruptedException JavaDoc;
37
38     public Enumeration JavaDoc snapShot();
39
40     public Enumeration JavaDoc snapShot(SomniMessageSelector messageSelector)
41         throws SomniMessageSelectorException;
42         
43     /**
44 Guess the number of objects waiting in the Takable.
45     */

46     public int guessSize();
47
48     /**
49     @return the head of this queue without removing it.
50     */

51     public Elem peek();
52  
53 }
54
55 /* Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006 David Walend
56 All rights reserved.
57
58 Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
59
60 Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
61
62 Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
63
64 Neither the name of the SomnifugiJMS Project, walend.net, nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission from David Walend.
65
66 Credits in redistributions in source or binary forms must include a link to http://somnifugi.sourceforge.net .
67
68 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
69 The net.walend.somnifugi.sql92 package is modified code from the openmq project, https://mq.dev.java.net/ , Copyright (c) of Sun, and carries the CDDL license, repeated here: You can obtain a copy of the license at https://glassfish.dev.java.net/public/CDDLv1.0.html. See the License for the specific language governing permissions and limitations under the License.
70
71 =================================================================================
72
73 For more information and the latest version of this software, please see http://somnifugi.sourceforge.net and http://walend.net or email <a HREF="mailto:david@walend.net">david@walend.net</a>.
74  */

75
Popular Tags