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 TypeMethodDescriptionlong
Returns a timestamp of the oldest registered subject.boolean
isEmpty()
Call this function to determine whether the collection is empty or not.static <K,
V> TimestampedCollection<K, V> boolean
Creates a newsubject
registration.Registers asubject
and maps it to a givencorrelationId
.boolean
Creates a newsubject
registration.Removes a registration from the collection based on acorrelationId
and 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
.int
size()
Returns the number of elements in this collection.
-
Method Details
-
newInstance
-
register
Registers asubject
and 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 givensubject
subject
- a primary registration object- Returns:
- old
subject
associated with a givencorrelationId
ornull
if there's no suchsubject
- See Also:
-
register
Creates a newsubject
registration. 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:
true
if the registration was successfull,false
otherwise- See Also:
-
register
Creates a newsubject
registration. The newly created registration is timestamped using a value of thetimestamp
parameter 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:
true
if the registration was successfull,false
otherwise- See Also:
-
remove
Removes a registration from the collection based on acorrelationId
and returns the value of the registeredsubject
. This method may returnnull
- Parameters:
correlationId
- identifier to be associated with an already registeredsubject
- Returns:
- a registered
subject
associated with a givencorrelationId
ornull
if 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:
true
if the collection is empty,false
otherwise
-
size
public int size()Returns the number of elements in this collection. If the collection contains more thanInteger.MAX_VALUE
elements, 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:
-