Package com.sun.xml.ws.rx.util
Class TimestampedCollection<K,V>
java.lang.Object
com.sun.xml.ws.rx.util.TimestampedCollection<K,V>
- Direct Known Subclasses:
SuspendedFiberStorage
TODO javadoc
WARNING: This class is a private utility class used by WS-RX implementation. Any usage outside
the intedned scope is strongly discouraged. The API exposed by this class may be changed, replaced
or removed without any advance notice.
-
Method Summary
Modifier and TypeMethodDescriptionlongReturns a timestamp of the oldest registered subject.booleanisEmpty()Call this function to determine whether the collection is empty or not.static <K,V> TimestampedCollection<K, V> booleanCreates a newsubjectregistration.Registers asubjectand maps it to a givencorrelationId.booleanCreates a newsubjectregistration.Removes a registration from the collection based on acorrelationIdand returns the value of the registeredsubject.Removes all values from the time-stamped collection and returns them as an ordered FIFO list.Removes the oldest registration from the collection and returns the value of the registeredsubject.intsize()Returns the number of elements in this collection.
-
Method Details
-
newInstance
-
register
Registers asubjectand maps it to a givencorrelationId. The newly created registration is timestamped which allows for later removal based on the age of registration usingremoveOldest()method.- Parameters:
correlationId- correlation identifier to be associated with a givensubjectsubject- a primary registration object- Returns:
- old
subjectassociated with a givencorrelationIdornullif there's no suchsubject - See Also:
-
register
Creates a newsubjectregistration. The newly created registration is timestamped which allows for later removal based on the age of registration usingremoveOldest()method.- Parameters:
subject- a primary registration subject- Returns:
trueif the registration was successfull,falseotherwise- See Also:
-
register
Creates a newsubjectregistration. The newly created registration is timestamped using a value of thetimestampparameter which allows for later removal based on the age of registration usingremoveOldest()method.- Parameters:
timestamp- a timestamp to be used for the registrationsubject- a primary registration subject- Returns:
trueif the registration was successfull,falseotherwise- See Also:
-
remove
Removes a registration from the collection based on acorrelationIdand returns the value of the registeredsubject. This method may returnnull- Parameters:
correlationId- identifier to be associated with an already registeredsubject- Returns:
- a registered
subjectassociated with a givencorrelationIdornullif there's no suchsubject - See Also:
-
removeOldest
Removes the oldest registration from the collection and returns the value of the registeredsubject.- Returns:
- an oldest registered
subject - Throws:
NoSuchElementException- if the underlying collection is empty.- See Also:
-
removeAll
Removes all values from the time-stamped collection and returns them as an ordered FIFO list.- Returns:
- ordered FIFO list of the removed values. Returns empty list in case there are no values stored in the collection.
-
isEmpty
public boolean isEmpty()Call this function to determine whether the collection is empty or not.- Returns:
trueif the collection is empty,falseotherwise
-
size
public int size()Returns the number of elements in this collection. If the collection contains more thanInteger.MAX_VALUEelements, returnsInteger.MAX_VALUE.- Returns:
- the number of elements in this collection.
-
getOldestRegistrationTimestamp
public long getOldestRegistrationTimestamp()Returns a timestamp of the oldest registered subject.- Returns:
- timestamp of the oldest registered subject.
- Throws:
NoSuchElementException- if the underlying collection is empty.- See Also:
-