KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > quadcap > util > Queue


1 /* Copyright 1997 - 2003 Quadcap Software. All rights reserved.
2  *
3  * This software is distributed under the Quadcap Free Software License.
4  * This software may be used or modified for any purpose, personal or
5  * commercial. Open Source redistributions are permitted. Commercial
6  * redistribution of larger works derived from, or works which bundle
7  * this software requires a "Commercial Redistribution License"; see
8  * http://www.quadcap.com/purchase.
9  *
10  * Redistributions qualify as "Open Source" under one of the following terms:
11  *
12  * Redistributions are made at no charge beyond the reasonable cost of
13  * materials and delivery.
14  *
15  * Redistributions are accompanied by a copy of the Source Code or by an
16  * irrevocable offer to provide a copy of the Source Code for up to three
17  * years at the cost of materials and delivery. Such redistributions
18  * must allow further use, modification, and redistribution of the Source
19  * Code under substantially the same terms as this license.
20  *
21  * Redistributions of source code must retain the copyright notices as they
22  * appear in each source code file, these license terms, and the
23  * disclaimer/limitation of liability set forth as paragraph 6 below.
24  *
25  * Redistributions in binary form must reproduce this Copyright Notice,
26  * these license terms, and the disclaimer/limitation of liability set
27  * forth as paragraph 6 below, in the documentation and/or other materials
28  * provided with the distribution.
29  *
30  * The Software is provided on an "AS IS" basis. No warranty is
31  * provided that the Software is free of defects, or fit for a
32  * particular purpose.
33  *
34  * Limitation of Liability. Quadcap Software shall not be liable
35  * for any damages suffered by the Licensee or any third party resulting
36  * from use of the Software.
37  */

38
39 package com.quadcap.util;
40
41 /**
42  * This class implements a thread-safe queue.
43  *
44  * @author Stan Bailes
45  */

46 public class Queue extends DList {
47     public Queue() {
48     }
49
50     public synchronized void push(Object JavaDoc obj) {
51     addBack(obj);
52     }
53
54     public synchronized Object JavaDoc pop() {
55     try {
56         return popFront();
57     } catch (ListException e) {
58        RuntimeException JavaDoc re = new RuntimeException JavaDoc(e.toString());
59        re.fillInStackTrace();
60        throw re;
61     }
62     }
63 }
64
Popular Tags