java.lang.Object
com.sun.xml.ws.commons.AbstractMOMRegistrationAware
com.sun.xml.ws.rx.rm.runtime.sequence.invm.InVmSequenceManager
All Implemented Interfaces:
com.sun.xml.ws.commons.MOMRegistrationAware, ReplicationManager<String,AbstractSequence>, SequenceManager, TimeSynchronizer

public final class InVmSequenceManager extends com.sun.xml.ws.commons.AbstractMOMRegistrationAware implements SequenceManager, ReplicationManager<String,AbstractSequence>
Author:
Marek Potociar (marek.potociar at sun.com)
  • Constructor Details

  • Method Details

    • persistent

      public boolean persistent()
      Specified by:
      persistent in interface SequenceManager
    • uniqueEndpointId

      public String uniqueEndpointId()
      Specified by:
      uniqueEndpointId in interface SequenceManager
    • sequences

      public Map<String,Sequence> sequences()
      Specified by:
      sequences in interface SequenceManager
    • boundSequences

      public Map<String,String> boundSequences()
      Specified by:
      boundSequences in interface SequenceManager
    • concurrentlyOpenedInboundSequencesCount

      public long concurrentlyOpenedInboundSequencesCount()
      Specified by:
      concurrentlyOpenedInboundSequencesCount in interface SequenceManager
    • createOutboundSequence

      public Sequence createOutboundSequence(String sequenceId, String strId, long expirationTime) throws DuplicateSequenceException
      Creates a new outbound sequence object with a given Id. It is assumed that RM handshake has been already established, thus no RM handshake is performed.
      Specified by:
      createOutboundSequence in interface SequenceManager
      Parameters:
      sequenceId - identifier of the new sequence
      strId - security reference token identifier which this session is bound to
      expirationTime - expiration time of the sequence in milliseconds; value of com.sun.xml.ws.rm.policy.Configuration#UNSPECIFIED means that this sequence never expires.
      Returns:
      newly created inbound sequence
      Throws:
      DuplicateSequenceException - in case a sequence instance with this identifier is already registered with this sequence manager
    • createInboundSequence

      public Sequence createInboundSequence(String sequenceId, String strId, long expirationTime) throws DuplicateSequenceException
      Creates a new inbound sequence object
      Specified by:
      createInboundSequence in interface SequenceManager
      Parameters:
      sequenceId - identifier of the new sequence
      strId - security reference token identifier which this session is bound to
      expirationTime - expiration time of the sequence in milliseconds; value of com.sun.xml.ws.rm.policy.Configuration#UNSPECIFIED means that this sequence never expires.
      Returns:
      newly created inbound sequence
      Throws:
      DuplicateSequenceException - in case a sequence instance with this identifier is already registered with this sequence manager
    • generateSequenceUID

      public String generateSequenceUID()
      Generates a unique identifier of a sequence
      Specified by:
      generateSequenceUID in interface SequenceManager
      Returns:
      new unique sequence identifier which can be used to construct a new sequence.
    • closeSequence

      public Sequence closeSequence(String sequenceId) throws UnknownSequenceException
      Closes an existing sequence. The closed sequence is still kept in the internal sequence storage
      Specified by:
      closeSequence in interface SequenceManager
      Parameters:
      sequenceId - the unique sequence identifier
      Returns:
      closed sequence object
      Throws:
      UnknownSequenceException
    • getSequence

      public Sequence getSequence(String sequenceId) throws UnknownSequenceException
      Retrieves an existing sequence from the internal sequence storage
      Specified by:
      getSequence in interface SequenceManager
      Parameters:
      sequenceId - the unique sequence identifier
      Returns:
      sequence identified with the sequenceId identifier
      Throws:
      UnknownSequenceException - in case no such sequence is registered within the sequence manager
    • getInboundSequence

      public Sequence getInboundSequence(String sequenceId) throws UnknownSequenceException
      Retrieves an existing inbound sequence from the internal sequence storage
      Specified by:
      getInboundSequence in interface SequenceManager
      Parameters:
      sequenceId - the unique sequence identifier
      Returns:
      sequence identified with the sequenceId identifier
      Throws:
      UnknownSequenceException - in case no such sequence is registered within the sequence manager or in case the registered sequence was not created as inbound.
    • getOutboundSequence

      public Sequence getOutboundSequence(String sequenceId) throws UnknownSequenceException
      Retrieves an existing outbound sequence from the internal sequence storage
      Specified by:
      getOutboundSequence in interface SequenceManager
      Parameters:
      sequenceId - the unique sequence identifier
      Returns:
      sequence identified with the sequenceId identifier
      Throws:
      UnknownSequenceException - in case no such sequence is registered within the sequence manager or in case the registered sequence was not created as outbound.
    • isValid

      public boolean isValid(String sequenceId)
      Provides information on whether the sequence identifier is a valid identifier that belongs to an existing sequence registered with the sequence manager.
      Specified by:
      isValid in interface SequenceManager
      Parameters:
      sequenceId - sequence identifier to be checked
      Returns:
      true in case the sequence identifier is valid, false otherwise
    • terminateSequence

      public Sequence terminateSequence(String sequenceId) throws UnknownSequenceException
      Terminates an existing sequence by calling the Sequence.preDestroy() method. In addition to this, the terminated sequence is removed from the internal sequence storage
      Specified by:
      terminateSequence in interface SequenceManager
      Parameters:
      sequenceId - the unique sequence identifier
      Returns:
      terminated sequence object
      Throws:
      UnknownSequenceException - in case no such sequence is registered within the sequence manager
    • bindSequences

      public void bindSequences(String referenceSequenceId, String boundSequenceId) throws UnknownSequenceException
      Binds two sequences together. This method is mainly intended to be used for binding together request and response sequences.
      Specified by:
      bindSequences in interface SequenceManager
      Parameters:
      referenceSequenceId - a reference sequence identifier to which the other sequence shall be bound.
      boundSequenceId - a bound sequence identifier
      Throws:
      UnknownSequenceException - in case any of the sequence identifiers does not represent a valid sequence
    • getBoundSequence

      public Sequence getBoundSequence(String referenceSequenceId) throws UnknownSequenceException
      Retrieves a sequence previously bound to the reference sequence
      Specified by:
      getBoundSequence in interface SequenceManager
      Parameters:
      referenceSequenceId - a reference sequence identifier to which the other sequence has been bound.
      Returns:
      bound sequence or null in case no sequence is bound to the reference sequence
      Throws:
      UnknownSequenceException - in case no such reference sequence is registered within the sequence manager
    • currentTimeInMillis

      public long currentTimeInMillis()
      Specified by:
      currentTimeInMillis in interface TimeSynchronizer
    • onMaintenance

      public boolean onMaintenance()
      Description copied from interface: SequenceManager
      Terminates all sequences that became expired in the meantime and removes all previously terminated sequences that were terminated sooner than a pre-configured period of time.

      This maintenance method is intended to be called externally by a SequenceMaintenanceTask instance associated with this SequenceManager.

      Specified by:
      onMaintenance in interface SequenceManager
      Returns:
      true if the next maintenance execution task is supposed to be scheduled, false otherwise.
    • invalidateCache

      public void invalidateCache()
      Description copied from interface: SequenceManager
      Instructs the SequenceManager instance to invalidate it's local cache. This prevents stale data being used and ensures that fresh data are loaded from the RM HA backing stores.
      Specified by:
      invalidateCache in interface SequenceManager
    • dispose

      public void dispose()
      Description copied from interface: SequenceManager
      Tells the SequenceManager that it is going to be disposed. An implementation of this interface can use the method to do the necessary resource cleanup.
      Specified by:
      dispose in interface SequenceManager
    • load

      public AbstractSequence load(String key)
      Specified by:
      load in interface ReplicationManager<String,AbstractSequence>
    • save

      public void save(String key, AbstractSequence sequence, boolean isNew)
      Specified by:
      save in interface ReplicationManager<String,AbstractSequence>
    • remove

      public void remove(String key)
      Specified by:
      remove in interface ReplicationManager<String,AbstractSequence>
    • close

      public void close()
      Specified by:
      close in interface ReplicationManager<String,AbstractSequence>
    • destroy

      public void destroy()
      Specified by:
      destroy in interface ReplicationManager<String,AbstractSequence>