Class InVmSequenceManager
- 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)
-
-
Field Summary
-
Fields inherited from interface com.sun.xml.ws.rx.rm.runtime.sequence.SequenceManager
MANAGED_BEAN_NAME
-
-
Constructor Summary
Constructors Constructor Description InVmSequenceManager(String uniqueEndpointId, DeliveryQueueBuilder inboundQueueBuilder, DeliveryQueueBuilder outboundQueueBuilder, RmConfiguration configuration, com.sun.xml.ws.api.server.Container container, LocalIDManager localIDManager)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidbindSequences(String referenceSequenceId, String boundSequenceId)Binds two sequences together.Map<String,String>boundSequences()voidclose()SequencecloseSequence(String sequenceId)Closes an existing sequence.longconcurrentlyOpenedInboundSequencesCount()SequencecreateInboundSequence(String sequenceId, String strId, long expirationTime)Creates a new inbound sequence objectSequencecreateOutboundSequence(String sequenceId, String strId, long expirationTime)Creates a new outbound sequence object with a given Id.longcurrentTimeInMillis()voiddestroy()voiddispose()Tells theSequenceManagerthat it is going to be disposed.StringgenerateSequenceUID()Generates a unique identifier of a sequenceSequencegetBoundSequence(String referenceSequenceId)Retrieves a sequence previously bound to the reference sequenceSequencegetInboundSequence(String sequenceId)Retrieves an existing inbound sequence from the internal sequence storageSequencegetOutboundSequence(String sequenceId)Retrieves an existing outbound sequence from the internal sequence storageSequencegetSequence(String sequenceId)Retrieves an existing sequence from the internal sequence storagevoidinvalidateCache()Instructs theSequenceManagerinstance to invalidate it's local cache.booleanisValid(String sequenceId)Provides information on whether the sequence identifier is a valid identifier that belongs to an existing sequence registered with the sequence manager.AbstractSequenceload(String key)booleanonMaintenance()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.booleanpersistent()voidremove(String key)voidsave(String key, AbstractSequence sequence, boolean isNew)Map<String,Sequence>sequences()SequenceterminateSequence(String sequenceId)Terminates an existing sequence by calling theSequence.preDestroy()method.StringuniqueEndpointId()-
Methods inherited from class com.sun.xml.ws.commons.AbstractMOMRegistrationAware
isRegisteredAtMOM, setRegisteredAtMOM
-
-
-
-
Constructor Detail
-
InVmSequenceManager
public InVmSequenceManager(String uniqueEndpointId, DeliveryQueueBuilder inboundQueueBuilder, DeliveryQueueBuilder outboundQueueBuilder, RmConfiguration configuration, com.sun.xml.ws.api.server.Container container, LocalIDManager localIDManager)
-
-
Method Detail
-
persistent
public boolean persistent()
- Specified by:
persistentin interfaceSequenceManager
-
uniqueEndpointId
public String uniqueEndpointId()
- Specified by:
uniqueEndpointIdin interfaceSequenceManager
-
sequences
public Map<String,Sequence> sequences()
- Specified by:
sequencesin interfaceSequenceManager
-
boundSequences
public Map<String,String> boundSequences()
- Specified by:
boundSequencesin interfaceSequenceManager
-
concurrentlyOpenedInboundSequencesCount
public long concurrentlyOpenedInboundSequencesCount()
- Specified by:
concurrentlyOpenedInboundSequencesCountin interfaceSequenceManager
-
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:
createOutboundSequencein interfaceSequenceManager- Parameters:
sequenceId- identifier of the new sequencestrId- security reference token identifier which this session is bound toexpirationTime- expiration time of the sequence in milliseconds; value ofcom.sun.xml.ws.rm.policy.Configuration#UNSPECIFIEDmeans that this sequence never expires.- Returns:
- newly created inbound sequence
- Throws:
DuplicateSequenceException
-
createInboundSequence
public Sequence createInboundSequence(String sequenceId, String strId, long expirationTime) throws DuplicateSequenceException
Creates a new inbound sequence object- Specified by:
createInboundSequencein interfaceSequenceManager- Parameters:
sequenceId- identifier of the new sequencestrId- security reference token identifier which this session is bound toexpirationTime- expiration time of the sequence in milliseconds; value ofcom.sun.xml.ws.rm.policy.Configuration#UNSPECIFIEDmeans that this sequence never expires.- Returns:
- newly created inbound sequence
- Throws:
DuplicateSequenceException
-
generateSequenceUID
public String generateSequenceUID()
Generates a unique identifier of a sequence- Specified by:
generateSequenceUIDin interfaceSequenceManager- 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:
closeSequencein interfaceSequenceManager- 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:
getSequencein interfaceSequenceManager- Parameters:
sequenceId- the unique sequence identifier- Returns:
- sequence identified with the
sequenceIdidentifier - 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:
getInboundSequencein interfaceSequenceManager- Parameters:
sequenceId- the unique sequence identifier- Returns:
- sequence identified with the
sequenceIdidentifier - 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:
getOutboundSequencein interfaceSequenceManager- Parameters:
sequenceId- the unique sequence identifier- Returns:
- sequence identified with the
sequenceIdidentifier - 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:
isValidin interfaceSequenceManager- Parameters:
sequenceId- sequence identifier to be checked- Returns:
truein case the sequence identifier is valid,falseotherwise
-
terminateSequence
public Sequence terminateSequence(String sequenceId) throws UnknownSequenceException
Terminates an existing sequence by calling theSequence.preDestroy()method. In addition to this, the terminated sequence is removed from the internal sequence storage- Specified by:
terminateSequencein interfaceSequenceManager- Parameters:
sequenceId- the unique sequence identifier- Returns:
- terminated sequence object
- Throws:
UnknownSequenceException
-
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:
bindSequencesin interfaceSequenceManager- 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:
getBoundSequencein interfaceSequenceManager- Parameters:
referenceSequenceId- a reference sequence identifier to which the other sequence has been bound.- Returns:
- bound sequence or
nullin case no sequence is bound to the reference sequence - Throws:
UnknownSequenceException
-
currentTimeInMillis
public long currentTimeInMillis()
- Specified by:
currentTimeInMillisin interfaceTimeSynchronizer
-
onMaintenance
public boolean onMaintenance()
Description copied from interface:SequenceManagerTerminates 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 aSequenceMaintenanceTaskinstance associated with thisSequenceManager.- Specified by:
onMaintenancein interfaceSequenceManager- Returns:
trueif the next maintenance execution task is supposed to be scheduled,falseotherwise.
-
invalidateCache
public void invalidateCache()
Description copied from interface:SequenceManagerInstructs theSequenceManagerinstance 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:
invalidateCachein interfaceSequenceManager
-
dispose
public void dispose()
Description copied from interface:SequenceManagerTells theSequenceManagerthat it is going to be disposed. An implementation of this interface can use the method to do the necessary resource cleanup.- Specified by:
disposein interfaceSequenceManager
-
load
public AbstractSequence load(String key)
- Specified by:
loadin interfaceReplicationManager<String,AbstractSequence>
-
save
public void save(String key, AbstractSequence sequence, boolean isNew)
- Specified by:
savein interfaceReplicationManager<String,AbstractSequence>
-
remove
public void remove(String key)
- Specified by:
removein interfaceReplicationManager<String,AbstractSequence>
-
close
public void close()
- Specified by:
closein interfaceReplicationManager<String,AbstractSequence>
-
destroy
public void destroy()
- Specified by:
destroyin interfaceReplicationManager<String,AbstractSequence>
-
-