KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jacorb > notification > queue > MessageQueue


1 package org.jacorb.notification.queue;
2
3 /*
4  * JacORB - a free Java ORB
5  *
6  * Copyright (C) 1999-2004 Gerald Brose
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Library General Public
10  * License as published by the Free Software Foundation; either
11  * version 2 of the License, or (at your option) any later version.
12  *
13  * This library is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  * Library General Public License for more details.
17  *
18  * You should have received a copy of the GNU Library General Public
19  * License along with this library; if not, write to the Free
20  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21  *
22  */

23
24 import org.jacorb.notification.interfaces.Message;
25
26 /**
27  * @author Alphonse Bendt
28  * @version $Id: MessageQueue.java,v 1.1 2005/02/14 00:11:10 alphonse.bendt Exp $
29  */

30
31 public interface MessageQueue
32 {
33     /**
34      * get the next Message from this queue. which particular event is
35      * selected depends on the underlying implementation.
36      *
37      * @param wait a <code>boolean</code> value. If this parameter is
38      * set to true the queue will block until an element is
39      * available. If the parameter is set to false the queue will
40      * return null in case it is empty.
41      *
42      * @exception InterruptedException
43      */

44     Message getMessage( boolean wait )
45         throws InterruptedException JavaDoc;
46
47     /**
48      * get up to <code>n</code> events from this queue.
49      *
50      * @param n number of requested messages
51      *
52      * @param wait a <code>boolean</code> value. If this parameter is
53      * set to true the queue will block until an element is
54      * available. If the parameter is set to false the queue will
55      * return null in case it is empty.
56      */

57     Message[] getMessages( int n, boolean wait )
58         throws InterruptedException JavaDoc;
59
60     /**
61      * get all Messages from this queue.
62  
63      * @param wait a <code>boolean</code> value. If this parameter is
64      * set to true the queue will block until an element is
65      * available. If the parameter is set to false the queue will
66      * return null in case it is empty.
67      */

68     Message[] getAllMessages( boolean wait )
69         throws InterruptedException JavaDoc;
70
71     /**
72      * put a Message into this queue.
73      */

74     void put( Message event );
75
76     /**
77      * check if this queue is empty.
78      */

79     boolean isEmpty();
80
81     /**
82      * access the current size of this queue.
83      */

84     int getSize();
85 }
86
Popular Tags