Package org.apache.cxf.ws.rm.soap
Class RetransmissionQueueImpl
- java.lang.Object
-
- org.apache.cxf.ws.rm.soap.RetransmissionQueueImpl
-
- All Implemented Interfaces:
RetransmissionQueue
public class RetransmissionQueueImpl extends Object implements RetransmissionQueue
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
RetransmissionQueueImpl.CopyOutInterceptor
protected class
RetransmissionQueueImpl.ResendCandidate
Represents a candidate for resend, i.e.static interface
RetransmissionQueueImpl.Resender
Encapsulates actual resend logic (pluggable to facilitate unit testing)
-
Field Summary
-
Fields inherited from interface org.apache.cxf.ws.rm.RetransmissionQueue
DEFAULT_BASE_RETRANSMISSION_INTERVAL, DEFAULT_EXPONENTIAL_BACKOFF
-
-
Constructor Summary
Constructors Constructor Description RetransmissionQueueImpl(RMManager m)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addUnacknowledged(org.apache.cxf.message.Message message)
Accepts a new message for possible future retransmission.protected org.apache.cxf.transport.Conduit
buildConduit(org.apache.cxf.binding.soap.SoapMessage message, org.apache.cxf.endpoint.Endpoint endpoint, org.apache.cxf.ws.addressing.AttributedURIType to)
protected org.apache.cxf.phase.PhaseInterceptorChain
buildRetransmitChain(org.apache.cxf.endpoint.Endpoint endpoint, org.apache.cxf.phase.PhaseChainCache cache)
protected RetransmissionQueueImpl.ResendCandidate
cacheUnacknowledged(org.apache.cxf.message.Message message)
Accepts a new resend candidate.int
countUnacknowledged()
int
countUnacknowledged(SourceSequence seq)
protected RetransmissionQueueImpl.ResendCandidate
createResendCandidate(org.apache.cxf.message.Message message)
protected org.apache.cxf.ws.policy.builder.jaxb.JaxbAssertion<RMAssertion>
getAssertion(org.apache.cxf.ws.policy.AssertionInfo ai)
protected RetransmissionQueueImpl.Resender
getDefaultResender()
Create default Resender logic.protected int
getExponentialBackoff()
RMManager
getManager()
RetryStatus
getRetransmissionStatus(SourceSequence seq, long num)
Returns the retransmission status for the specified message.Map<Long,RetryStatus>
getRetransmissionStatuses(SourceSequence seq)
Return the retransmission status of all the messages assigned to the sequence.protected List<RetransmissionQueueImpl.ResendCandidate>
getSequenceCandidates(String key)
protected List<RetransmissionQueueImpl.ResendCandidate>
getSequenceCandidates(SourceSequence seq)
protected Map<String,List<RetransmissionQueueImpl.ResendCandidate>>
getUnacknowledged()
List<Long>
getUnacknowledgedMessageNumbers(SourceSequence seq)
boolean
isEmpty()
protected boolean
isSequenceSuspended(String key)
void
purgeAcknowledged(SourceSequence seq)
Purge all candidates for the given sequence that have been acknowledged.void
purgeAll(SourceSequence seq)
Purge all candidates for the given sequence.protected void
replaceResender(RetransmissionQueueImpl.Resender replacement)
Plug in replacement resend logic (facilitates unit testing).void
resume(SourceSequence seq)
Resumes the retransmission attempts for the specified sequencevoid
setManager(RMManager m)
void
start()
Initiate resends.void
stop(SourceSequence seq)
Stops resending messages for the specified source sequence.void
suspend(SourceSequence seq)
Suspends the retransmission attempts for the specified sequence
-
-
-
Constructor Detail
-
RetransmissionQueueImpl
public RetransmissionQueueImpl(RMManager m)
-
-
Method Detail
-
getManager
public RMManager getManager()
-
setManager
public void setManager(RMManager m)
-
addUnacknowledged
public void addUnacknowledged(org.apache.cxf.message.Message message)
Description copied from interface:RetransmissionQueue
Accepts a new message for possible future retransmission. Implementations must call the RMEndpoint.handleAccepted() method for each accepted message.- Specified by:
addUnacknowledged
in interfaceRetransmissionQueue
- Parameters:
message
- the message context.
-
countUnacknowledged
public int countUnacknowledged(SourceSequence seq)
- Specified by:
countUnacknowledged
in interfaceRetransmissionQueue
- Parameters:
seq
- the sequence under consideration- Returns:
- the number of unacknowledged messages for that sequence
-
countUnacknowledged
public int countUnacknowledged()
- Specified by:
countUnacknowledged
in interfaceRetransmissionQueue
- Returns:
- the total number of unacknowledged messages in this queue
-
isEmpty
public boolean isEmpty()
- Specified by:
isEmpty
in interfaceRetransmissionQueue
- Returns:
- true if there are no unacknowledged messages in the queue
-
purgeAcknowledged
public void purgeAcknowledged(SourceSequence seq)
Purge all candidates for the given sequence that have been acknowledged.- Specified by:
purgeAcknowledged
in interfaceRetransmissionQueue
- Parameters:
seq
- the sequence object.
-
purgeAll
public void purgeAll(SourceSequence seq)
Purge all candidates for the given sequence. This method is used to terminate the sequence by force and release the resource associated with the sequence.- Specified by:
purgeAll
in interfaceRetransmissionQueue
- Parameters:
seq
- the sequence object.
-
getUnacknowledgedMessageNumbers
public List<Long> getUnacknowledgedMessageNumbers(SourceSequence seq)
- Specified by:
getUnacknowledgedMessageNumbers
in interfaceRetransmissionQueue
- Returns:
-
getRetransmissionStatus
public RetryStatus getRetransmissionStatus(SourceSequence seq, long num)
Description copied from interface:RetransmissionQueue
Returns the retransmission status for the specified message.- Specified by:
getRetransmissionStatus
in interfaceRetransmissionQueue
- Returns:
-
getRetransmissionStatuses
public Map<Long,RetryStatus> getRetransmissionStatuses(SourceSequence seq)
Description copied from interface:RetransmissionQueue
Return the retransmission status of all the messages assigned to the sequence.- Specified by:
getRetransmissionStatuses
in interfaceRetransmissionQueue
- Returns:
-
start
public void start()
Initiate resends.- Specified by:
start
in interfaceRetransmissionQueue
-
stop
public void stop(SourceSequence seq)
Stops resending messages for the specified source sequence.- Specified by:
stop
in interfaceRetransmissionQueue
-
suspend
public void suspend(SourceSequence seq)
Description copied from interface:RetransmissionQueue
Suspends the retransmission attempts for the specified sequence- Specified by:
suspend
in interfaceRetransmissionQueue
-
resume
public void resume(SourceSequence seq)
Description copied from interface:RetransmissionQueue
Resumes the retransmission attempts for the specified sequence- Specified by:
resume
in interfaceRetransmissionQueue
-
getExponentialBackoff
protected int getExponentialBackoff()
- Returns:
- the exponential backoff
-
createResendCandidate
protected RetransmissionQueueImpl.ResendCandidate createResendCandidate(org.apache.cxf.message.Message message)
- Parameters:
message
- the message context- Returns:
- a ResendCandidate
-
cacheUnacknowledged
protected RetransmissionQueueImpl.ResendCandidate cacheUnacknowledged(org.apache.cxf.message.Message message)
Accepts a new resend candidate.- Parameters:
message
- the message object.- Returns:
- ResendCandidate
-
getUnacknowledged
protected Map<String,List<RetransmissionQueueImpl.ResendCandidate>> getUnacknowledged()
- Returns:
- a map relating sequence ID to a lists of un-acknowledged messages for that sequence
-
getSequenceCandidates
protected List<RetransmissionQueueImpl.ResendCandidate> getSequenceCandidates(SourceSequence seq)
- Parameters:
seq
- the sequence under consideration- Returns:
- the list of resend candidates for that sequence
-
getSequenceCandidates
protected List<RetransmissionQueueImpl.ResendCandidate> getSequenceCandidates(String key)
- Parameters:
key
- the sequence identifier under consideration- Returns:
- the list of resend candidates for that sequence
-
isSequenceSuspended
protected boolean isSequenceSuspended(String key)
- Parameters:
key
- the sequence identifier under consideration- Returns:
- true if the sequence is currently suspended; false otherwise
-
getDefaultResender
protected final RetransmissionQueueImpl.Resender getDefaultResender()
Create default Resender logic.- Returns:
- default Resender
-
replaceResender
protected void replaceResender(RetransmissionQueueImpl.Resender replacement)
Plug in replacement resend logic (facilitates unit testing).- Parameters:
replacement
- resend logic
-
getAssertion
protected org.apache.cxf.ws.policy.builder.jaxb.JaxbAssertion<RMAssertion> getAssertion(org.apache.cxf.ws.policy.AssertionInfo ai)
-
buildConduit
protected org.apache.cxf.transport.Conduit buildConduit(org.apache.cxf.binding.soap.SoapMessage message, org.apache.cxf.endpoint.Endpoint endpoint, org.apache.cxf.ws.addressing.AttributedURIType to)
- Parameters:
message
-endpoint
-to
-- Returns:
-
buildRetransmitChain
protected org.apache.cxf.phase.PhaseInterceptorChain buildRetransmitChain(org.apache.cxf.endpoint.Endpoint endpoint, org.apache.cxf.phase.PhaseChainCache cache)
- Parameters:
endpoint
-cache
-- Returns:
-
-