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)
  • Field Details

  • Method Details

    • getId

      public String getId()
      Description copied from interface: Sequence
      Returns unique identifier of the sequence
      Specified by:
      getId in interface Sequence
      Returns:
      unique sequence identifier
    • getBoundSecurityTokenReferenceId

      public String getBoundSecurityTokenReferenceId()
      Description copied from interface: Sequence
      Provides information on a security session to which this sequence is bound to.
      Specified by:
      getBoundSecurityTokenReferenceId in interface Sequence
      Returns:
      security token reference identifier to which this sequence is bound to.
    • getLastMessageNumber

      public long getLastMessageNumber()
      Description copied from interface: Sequence
      Provides information on the message number of the last message registered on this sequence
      Specified by:
      getLastMessageNumber in interface Sequence
      Returns:
      message number of the last message registered on this sequence
    • getAcknowledgedMessageNumbers

      public List<Sequence.AckRange> getAcknowledgedMessageNumbers()
      Description copied from interface: Sequence
      Provides a collection of ranges of message numbers acknowledged with the sequence
      Specified by:
      getAcknowledgedMessageNumbers in interface Sequence
      Returns:
      collection of ranges of message numbers registered with the sequence
    • isAcknowledged

      public boolean isAcknowledged(long messageNumber)
      Description copied from interface: Sequence
      Is this message number acknowledged with the sequence?
      Specified by:
      isAcknowledged in interface Sequence
      Parameters:
      messageNumber - in a sequence
      Returns:
      true if acknowledged, otherwise false
    • hasUnacknowledgedMessages

      public boolean hasUnacknowledgedMessages()
      Description copied from interface: Sequence
      The method may be called to determine whether the sequence has some unacknowledged messages or not
      Specified by:
      hasUnacknowledgedMessages in interface Sequence
      Returns:
      true if the sequence has any unacknowledged message identifiers, false otherwise
    • getState

      public Sequence.State getState()
      Description copied from interface: Sequence
      Provides information on the state of the message sequence
      Specified by:
      getState in interface Sequence
      Returns:
      current state of the message sequence
    • setAckRequestedFlag

      public void setAckRequestedFlag()
      Description copied from interface: Sequence
      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.
      Specified by:
      setAckRequestedFlag in interface Sequence
    • clearAckRequestedFlag

      public void clearAckRequestedFlag()
      Description copied from interface: Sequence
      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.
      Specified by:
      clearAckRequestedFlag in interface Sequence
    • isAckRequested

      public boolean isAckRequested()
      Description copied from interface: Sequence
      Provides information on the actual AckRequested flag status
      Specified by:
      isAckRequested in interface Sequence
      Returns:
      true if the AckRequested flag is set, false otherwise
    • isFailedOver

      public boolean isFailedOver(long messageNumber)
      Description copied from interface: Sequence
      Determines whether a given message number is registered as received, unacknowledged and failed over.
      Specified by:
      isFailedOver in interface Sequence
      Parameters:
      messageNumber - message number to be tested
      Returns:
      true if the message number is registered as received, unacknowledged and failed over, false otherwise
    • updateLastAcknowledgementRequestTime

      public void updateLastAcknowledgementRequestTime()
      Description copied from interface: Sequence
      Updates information on when was the last acknowledgement request for this sequence sent to current time.
      Specified by:
      updateLastAcknowledgementRequestTime in interface Sequence
    • getLastActivityTime

      public long getLastActivityTime()
      Description copied from interface: Sequence
      Specified by:
      getLastActivityTime in interface Sequence
      Returns:
      last activity time on the sequence in milliseconds
    • isStandaloneAcknowledgementRequestSchedulable

      public boolean isStandaloneAcknowledgementRequestSchedulable(long delayPeriod)
      Description copied from interface: Sequence
      Determines whether a standalone acnowledgement request can be scheduled or not based on the Sequence.hasUnacknowledgedMessages() value, last acknowledgement request time (see Sequence.updateLastAcknowledgementRequestTime()) and delayPeriod parameter. Returns true if the sequence has any pending acknowledgements is set and last acknowledgement request time is older than delay period substracted from the current time. Returns false otherwise.
      Specified by:
      isStandaloneAcknowledgementRequestSchedulable in interface Sequence
      Parameters:
      delayPeriod - delay period that should pass since the last acknowledgement request before an autonomous acnowledgement request is sent.
      Returns:
      true or false depending on whether
    • close

      public void close()
      Description copied from interface: Sequence
      Closes 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 a IllegalStateException being raised. It is however still possible to accept message identifier acknowledgements, as well as retrieve any other information on the sequence.

      Specified by:
      close in interface Sequence
    • isClosed

      public boolean isClosed()
      Description copied from interface: Sequence
      Provides information on the sequence closed status.
      Specified by:
      isClosed in interface Sequence
      Returns:
      true if the sequence has been closed, false otherwise
    • isExpired

      public boolean isExpired()
      Description copied from interface: Sequence
      Provides information on the sequence expiration status.
      Specified by:
      isExpired in interface Sequence
      Returns:
      true if the sequence has already expired, false otherwise
    • preDestroy

      public void preDestroy()
      Description copied from interface: Sequence
      The method is called during the sequence termination to allow sequence object to release its allocated resources
      Specified by:
      preDestroy in interface Sequence
    • getData

      public SequenceData getData()
    • retrieveMessage

      public ApplicationMessage retrieveMessage(String correlationId)
      Description copied from interface: Sequence
      Retrieves a message stored within the sequence under the provided correlationId if avalable. May return null if no stored message under given correlationId is available.

      Availability of the message depends on the message identifier acknowledgement. Message, if stored (see Sequence.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:
      retrieveMessage in interface Sequence
      Parameters:
      correlationId - correlation identifier of the stored ApplicationMessage
      Returns:
      the message that is stored in the sequence if available, null otherwise.
    • getDeliveryQueue

      public DeliveryQueue getDeliveryQueue()
      Description copied from interface: Sequence
      Updates 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:
      getDeliveryQueue in interface Sequence
      Returns:
      delivery queue with a messages waiting for a delivery on this particular sequence
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object