Class AbstractSequence
- java.lang.Object
-
- com.sun.xml.ws.rx.rm.runtime.sequence.AbstractSequence
-
- All Implemented Interfaces:
Sequence
- Direct Known Subclasses:
InboundSequence,OutboundSequence
public abstract class AbstractSequence extends Object implements Sequence
Provides abstract sequence implementation common to both - inbound and outbound sequence- Author:
- Marek Potociar (marek.potociar at sun.com)
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.sun.xml.ws.rx.rm.runtime.sequence.Sequence
Sequence.AckRange, Sequence.IncompleteSequenceBehavior, Sequence.State
-
-
Field Summary
Fields Modifier and Type Field Description protected SequenceDatadata-
Fields inherited from interface com.sun.xml.ws.rx.rm.runtime.sequence.Sequence
MAX_MESSAGE_ID, MIN_MESSAGE_ID, NO_EXPIRY, UNSPECIFIED_MESSAGE_ID
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclearAckRequestedFlag()This method should be called to clear the AckRequested flag, which indicates that any pending requests for acknowledgement of all message identifiers registered with this sequence were satisfied.voidclose()Closes the sequence.booleanequals(Object obj)List<Sequence.AckRange>getAcknowledgedMessageNumbers()Provides a collection of ranges of message numbers acknowledged with the sequenceStringgetBoundSecurityTokenReferenceId()Provides information on a security session to which this sequence is bound to.SequenceDatagetData()DeliveryQueuegetDeliveryQueue()Updates a delivery queue for this sequence with any unacknowledged messages that should be sent and returns the delivery queue instance.StringgetId()Returns unique identifier of the sequencelonggetLastActivityTime()Provides information on the last activity time of this sequence.longgetLastMessageNumber()Provides information on the message number of the last message registered on this sequenceSequence.StategetState()Provides information on the state of the message sequenceinthashCode()booleanhasUnacknowledgedMessages()The method may be called to determine whether the sequence has some unacknowledged messages or notbooleanisAcknowledged(long messageNumber)Is this message number acknowledged with the sequence?booleanisAckRequested()Provides information on the actual AckRequested flag statusbooleanisClosed()Provides information on the sequence closed status.booleanisExpired()Provides information on the sequence expiration status.booleanisFailedOver(long messageNumber)Determines whether a given message number is registered as received, unacknowledged and failed over.booleanisStandaloneAcknowledgementRequestSchedulable(long delayPeriod)Determines whether a standalone acnowledgement request can be scheduled or not based on the#hasPendingAcknowledgements()value, last acknowledgement request time (seeSequence.updateLastAcknowledgementRequestTime()) anddelayPeriodparameter.voidpreDestroy()The method is called during the sequence termination to allow sequence object to release its allocated resourcesApplicationMessageretrieveMessage(String correlationId)Retrieves a message stored within the sequence under the providedcorrelationIdif avalable.voidsetAckRequestedFlag()This method should be called to set the AckRequested flag, which indicates a pending request for acknowledgement of all message identifiers registered with this sequence.voidupdateLastAcknowledgementRequestTime()Updates information on when was the last acknowledgement request for this sequence sent to current time.-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.sun.xml.ws.rx.rm.runtime.sequence.Sequence
acknowledgeMessageNumber, acknowledgeMessageNumbers, registerMessage
-
-
-
-
Field Detail
-
data
protected final SequenceData data
-
-
Method Detail
-
getId
public String getId()
Description copied from interface:SequenceReturns unique identifier of the sequence
-
getBoundSecurityTokenReferenceId
public String getBoundSecurityTokenReferenceId()
Description copied from interface:SequenceProvides information on a security session to which this sequence is bound to.- Specified by:
getBoundSecurityTokenReferenceIdin interfaceSequence- Returns:
- security token reference identifier to which this sequence is bound to.
-
getLastMessageNumber
public long getLastMessageNumber()
Description copied from interface:SequenceProvides information on the message number of the last message registered on this sequence- Specified by:
getLastMessageNumberin interfaceSequence- Returns:
- message number of the last message registered on this sequence
-
getAcknowledgedMessageNumbers
public List<Sequence.AckRange> getAcknowledgedMessageNumbers()
Description copied from interface:SequenceProvides a collection of ranges of message numbers acknowledged with the sequence- Specified by:
getAcknowledgedMessageNumbersin interfaceSequence- Returns:
- collection of ranges of message numbers registered with the sequence
-
isAcknowledged
public boolean isAcknowledged(long messageNumber)
Description copied from interface:SequenceIs this message number acknowledged with the sequence?- Specified by:
isAcknowledgedin interfaceSequence- Parameters:
messageNumber- in a sequence- Returns:
- true if acknowledged, otherwise false
-
hasUnacknowledgedMessages
public boolean hasUnacknowledgedMessages()
Description copied from interface:SequenceThe method may be called to determine whether the sequence has some unacknowledged messages or not- Specified by:
hasUnacknowledgedMessagesin interfaceSequence- Returns:
trueif the sequence has any unacknowledged message identifiers,falseotherwise
-
getState
public Sequence.State getState()
Description copied from interface:SequenceProvides information on the state of the message sequence
-
setAckRequestedFlag
public void setAckRequestedFlag()
Description copied from interface:SequenceThis method should be called to set the AckRequested flag, which indicates a pending request for acknowledgement of all message identifiers registered with this sequence.- Specified by:
setAckRequestedFlagin interfaceSequence
-
clearAckRequestedFlag
public void clearAckRequestedFlag()
Description copied from interface:SequenceThis method should be called to clear the AckRequested flag, which indicates that any pending requests for acknowledgement of all message identifiers registered with this sequence were satisfied.- Specified by:
clearAckRequestedFlagin interfaceSequence
-
isAckRequested
public boolean isAckRequested()
Description copied from interface:SequenceProvides information on the actual AckRequested flag status- Specified by:
isAckRequestedin interfaceSequence- Returns:
trueif the AckRequested flag is set,falseotherwise
-
isFailedOver
public boolean isFailedOver(long messageNumber)
Description copied from interface:SequenceDetermines whether a given message number is registered as received, unacknowledged and failed over.- Specified by:
isFailedOverin interfaceSequence- Parameters:
messageNumber- message number to be tested- Returns:
trueif the message number is registered as received, unacknowledged and failed over,falseotherwise
-
updateLastAcknowledgementRequestTime
public void updateLastAcknowledgementRequestTime()
Description copied from interface:SequenceUpdates information on when was the last acknowledgement request for this sequence sent to current time.- Specified by:
updateLastAcknowledgementRequestTimein interfaceSequence
-
getLastActivityTime
public long getLastActivityTime()
Description copied from interface:SequenceProvides information on the last activity time of this sequence. Following is the list of operations invocation of which causes an update of last activity time:Sequence.acknowledgeMessageNumber(long)Sequence.acknowledgeMessageNumbers(java.util.List)Sequence.clearAckRequestedFlag()Sequence.close()Sequence.registerMessage(ApplicationMessage, boolean)Sequence.retrieveMessage(java.lang.String)Sequence.setAckRequestedFlag()Sequence.updateLastAcknowledgementRequestTime()
- Specified by:
getLastActivityTimein interfaceSequence- Returns:
- last activity time on the sequence in milliseconds
-
isStandaloneAcknowledgementRequestSchedulable
public boolean isStandaloneAcknowledgementRequestSchedulable(long delayPeriod)
Description copied from interface:SequenceDetermines whether a standalone acnowledgement request can be scheduled or not based on the#hasPendingAcknowledgements()value, last acknowledgement request time (seeSequence.updateLastAcknowledgementRequestTime()) anddelayPeriodparameter. Returnstrueif the sequence has any pending acknowledgements is set and last acknowledgement request time is older than delay period substracted from the current time. Returnsfalseotherwise.- Specified by:
isStandaloneAcknowledgementRequestSchedulablein interfaceSequence- Parameters:
delayPeriod- delay period that should pass since the last acknowledgement request before an autonomous acnowledgement request is sent.- Returns:
trueorfalsedepending on whether
-
close
public void close()
Description copied from interface:SequenceCloses the sequence. Subsequent calls to this method have no effect.Once this method is called, any subsequent calls to the
#getNextMessageId()method will result in aIllegalStateExceptionbeing raised. It is however still possible to accept message identifier acknowledgements, as well as retrieve any other information on the sequence.
-
isClosed
public boolean isClosed()
Description copied from interface:SequenceProvides information on the sequence closed status.
-
isExpired
public boolean isExpired()
Description copied from interface:SequenceProvides information on the sequence expiration status.
-
preDestroy
public void preDestroy()
Description copied from interface:SequenceThe method is called during the sequence termination to allow sequence object to release its allocated resources- Specified by:
preDestroyin interfaceSequence
-
getData
public SequenceData getData()
-
retrieveMessage
public ApplicationMessage retrieveMessage(String correlationId)
Description copied from interface:SequenceRetrieves a message stored within the sequence under the providedcorrelationIdif avalable. May returnnullif no stored message under givencorrelationIdis available. Availability of the message depends on the message identifier acknowledgement. Message, if stored (seeSequence.registerMessage(com.sun.xml.ws.rx.rm.runtime.ApplicationMessage, boolean)remains available for retrieval until it is acknowledged. Once the message identifier associated with the stored message has been acknowledged, availability of the stored message is no longer guaranteed and stored message becomes eligible for garbage collection (if stored in memory) or removal. Note however, that message MAY still be available even after it has been acknowledged. Thus it is NOT safe to use this method as a test of a message acknowledgement.- Specified by:
retrieveMessagein interfaceSequence- Parameters:
correlationId- correlation identifier of the storedApplicationMessage- Returns:
- the message that is stored in the sequence if available,
nullotherwise.
-
getDeliveryQueue
public DeliveryQueue getDeliveryQueue()
Description copied from interface:SequenceUpdates a delivery queue for this sequence with any unacknowledged messages that should be sent and returns the delivery queue instance. Messages in the queue are the ones currently waiting for a delivery.- Specified by:
getDeliveryQueuein interfaceSequence- Returns:
- delivery queue with a messages waiting for a delivery on this particular sequence
-
-