01: package org.jacorb.notification.queue;
02:
03: /*
04: * JacORB - a free Java ORB
05: *
06: * Copyright (C) 1999-2004 Gerald Brose
07: *
08: * This library is free software; you can redistribute it and/or
09: * 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.2 2005/08/21 13:32:36 alphonse.bendt Exp $
29: */
30:
31: public interface MessageQueue {
32: interface DiscardListener {
33: void messageDiscarded(int maxSize);
34: }
35:
36: void addDiscardListener(DiscardListener listener);
37:
38: void removeDiscardListener(DiscardListener listener);
39:
40: /**
41: * get the next Message from this queue. which particular event is
42: * selected depends on the underlying implementation.
43: *
44: * @param wait a <code>boolean</code> value. If this parameter is
45: * set to true the queue will block until an element is
46: * available. If the parameter is set to false the queue will
47: * return null in case it is empty.
48: *
49: * @exception InterruptedException
50: */
51: Message getMessage(boolean wait) throws InterruptedException;
52:
53: /**
54: * get up to <code>n</code> events from this queue.
55: *
56: * @param n number of requested messages
57: *
58: * @param wait a <code>boolean</code> value. If this parameter is
59: * set to true the queue will block until an element is
60: * available. If the parameter is set to false the queue will
61: * return null in case it is empty.
62: */
63: Message[] getMessages(int n, boolean wait)
64: throws InterruptedException;
65:
66: /**
67: * get all Messages from this queue.
68:
69: * @param wait a <code>boolean</code> value. If this parameter is
70: * set to true the queue will block until an element is
71: * available. If the parameter is set to false the queue will
72: * return null in case it is empty.
73: */
74: Message[] getAllMessages(boolean wait) throws InterruptedException;
75:
76: /**
77: * put a Message into this queue.
78: */
79: void put(Message event);
80:
81: /**
82: * check if this queue is empty.
83: */
84: boolean isEmpty();
85:
86: /**
87: * access the current size of this queue.
88: */
89: int getSize();
90:
91: String getOrderPolicyName();
92:
93: String getDiscardPolicyName();
94: }
|