org.mortbay.util
Class ArrayIdQueue<E>

java.lang.Object
  extended by java.util.AbstractCollection<E>
      extended by java.util.AbstractList<E>
          extended by org.mortbay.util.ArrayQueue<E>
              extended by org.mortbay.util.ArrayIdQueue<E>
All Implemented Interfaces:
Iterable<E>, Collection<E>, List<E>, Queue<E>

public class ArrayIdQueue<E>
extends ArrayQueue<E>


Nested Class Summary
 class ArrayIdQueue.ArrayIdIterator
           
 
Field Summary
 
Fields inherited from class org.mortbay.util.ArrayQueue
_elements, _growCapacity, _lock, _nextE, _nextSlot, _size, DEFAULT_CAPACITY, DEFAULT_GROWTH
 
Fields inherited from class java.util.AbstractList
modCount
 
Constructor Summary
ArrayIdQueue()
           
ArrayIdQueue(int capacity)
           
ArrayIdQueue(int initCapacity, int growBy)
           
ArrayIdQueue(int initCapacity, int growBy, Object lock)
           
 
Method Summary
 boolean add(E e)
           
 void add(int index, E element)
           
 void addUnsafe(E e)
          Add without synchronization or bounds checking
 void decrementUnackedIndex()
           
 E get(int index)
           
 long getAssociatedId(int index)
           
 long getAssociatedIdUnsafe(int index)
           
 long getCurrentId()
           
 int getUnackedIndex()
           
protected  void grow()
           
 ArrayIdQueue.ArrayIdIterator idIterator()
           
 void incrementCurrentId()
           
 void incrementUnackedIndex()
           
 boolean offer(E e)
           
 E remove(int index)
           
 E set(int index, E element)
           
 void setCurrentId(int currentId)
           
 
Methods inherited from class org.mortbay.util.ArrayQueue
clear, element, getCapacity, getUnsafe, isEmpty, peek, poll, remove, size
 
Methods inherited from class java.util.AbstractList
addAll, equals, hashCode, indexOf, iterator, lastIndexOf, listIterator, listIterator, removeRange, subList
 
Methods inherited from class java.util.AbstractCollection
addAll, contains, containsAll, remove, removeAll, retainAll, toArray, toArray, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Collection
addAll, contains, containsAll, equals, hashCode, iterator, remove, removeAll, retainAll, toArray, toArray
 
Methods inherited from interface java.util.List
addAll, contains, containsAll, remove, removeAll, retainAll, toArray, toArray
 

Constructor Detail

ArrayIdQueue

public ArrayIdQueue()

ArrayIdQueue

public ArrayIdQueue(int capacity)

ArrayIdQueue

public ArrayIdQueue(int initCapacity,
                    int growBy)

ArrayIdQueue

public ArrayIdQueue(int initCapacity,
                    int growBy,
                    Object lock)
Method Detail

getUnackedIndex

public int getUnackedIndex()
Parameters:
unacked - marks which messages have been sent, and are awaiting a response. The index is the first message that has not yet been sent

incrementUnackedIndex

public void incrementUnackedIndex()

decrementUnackedIndex

public void decrementUnackedIndex()

getCurrentId

public long getCurrentId()
Returns:
currentId the latest batch that has been sent to the client

setCurrentId

public void setCurrentId(int currentId)

incrementCurrentId

public void incrementCurrentId()

add

public boolean add(E e)
Specified by:
add in interface Collection<E>
Specified by:
add in interface List<E>
Overrides:
add in class ArrayQueue<E>

addUnsafe

public void addUnsafe(E e)
Description copied from class: ArrayQueue
Add without synchronization or bounds checking

Overrides:
addUnsafe in class ArrayQueue<E>
See Also:
ArrayQueue.add(Object)

offer

public boolean offer(E e)
Specified by:
offer in interface Queue<E>
Overrides:
offer in class ArrayQueue<E>

getAssociatedId

public long getAssociatedId(int index)

getAssociatedIdUnsafe

public long getAssociatedIdUnsafe(int index)

remove

public E remove(int index)
Specified by:
remove in interface List<E>
Overrides:
remove in class ArrayQueue<E>

set

public E set(int index,
             E element)
Specified by:
set in interface List<E>
Overrides:
set in class ArrayQueue<E>

add

public void add(int index,
                E element)
Specified by:
add in interface List<E>
Overrides:
add in class ArrayQueue<E>

get

public E get(int index)
Specified by:
get in interface List<E>
Overrides:
get in class ArrayQueue<E>

grow

protected void grow()
Overrides:
grow in class ArrayQueue<E>

idIterator

public ArrayIdQueue.ArrayIdIterator idIterator()
Returns:
idIterator an iterator over the associated ids


Copyright © 1995-2009 Mort Bay Consulting. All Rights Reserved.