ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/i-scream/projects/cms/source/util/uk/org/iscream/cms/util/Queue.java
(Generate patch)

Comparing projects/cms/source/util/uk/org/iscream/cms/util/Queue.java (file contents):
Revision 1.16 by tdb, Wed Mar 14 23:25:29 2001 UTC vs.
Revision 1.19 by tdb, Thu Mar 22 18:23:27 2001 UTC

# Line 49 | Line 49 | public class Queue {
49       */
50      public static final int DROP = 3;
51      
52 +    /**
53 +     * To allow opposite lookups.
54 +     */
55 +    public static final String[] algorithms = {"RANDOM", "FIRST", "LAST", "DROP"};
56 +    
57   //---STATIC METHODS---
58  
59   //---CONSTRUCTORS---  
# Line 131 | Line 136 | public class Queue {
136              throw new InvalidQueueException("Requested queue "+queue+" does not exist");
137          }
138          // block if the queue is empty
139 <        if (((LinkedList) _lists.get(queue)).size() == 0) {
140 <            synchronized(((LinkedList) _lists.get(queue))) {
139 >        synchronized(((LinkedList) _lists.get(queue))) {
140 >            if (((LinkedList) _lists.get(queue)).size() == 0) {
141                  try { ((LinkedList) _lists.get(queue)).wait(); } catch(Exception e) {}
142              }
143          }
# Line 242 | Line 247 | public class Queue {
247       *
248       * @return An integer to be passed to the get() method.
249       */
250 <    public int getQueue() {
250 >    public synchronized int getQueue() {
251          int pos = -1;
252          for(int i=0; i < _lists.size(); i++) {
253              if(_lists.get(i) == null) {
# Line 266 | Line 271 | public class Queue {
271       *
272       * @param queue The integer identifier for the queue, given by getQueue().
273       */
274 <    public void removeQueue(int queue) {
274 >    public synchronized void removeQueue(int queue) {
275          _lists.set(queue, null);
276      }
277      

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines