reta commented on code in PR #3546:
URL: https://github.com/apache/cxf/pull/3546#discussion_r4201969169
##########
rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/soap/RetransmissionQueueImpl.java:
##########
@@ -401,6 +402,39 @@ protected boolean isSequenceSuspended(String key) {
return suspendedCandidates.containsKey(key);
}
+ /**
+ * Initiate the resend of the given candidate, after initiating the resend
of any earlier message of the
+ * same sequence which is due no later than it and not pending yet.
java.util.Timer does not run tasks
+ * scheduled for the same time in scheduling order, so for messages cached
within the same millisecond
+ * the resend of a later message could otherwise run (and, with in-order
delivery, block the resend
+ * thread until the receive timeout) before the resend of an earlier one.
+ *
+ * @param candidate the candidate whose resend is due
+ */
+ protected void initiateInOrder(ResendCandidate candidate) {
+ final Date due = candidate.getNext();
+ final List<ResendCandidate> earlier = new ArrayList<>();
+ if (null != due) {
+ String key =
RMContextUtils.retrieveRMProperties(candidate.getMessage(), true)
Review Comment:
Thanks @ffang , I am wondering if we have a problem here, will try to
explain the case:
- so we now fetch the sequence `getSequenceCandidates()` all the time (but
the items are not removed)
- it could happen that another task gets scheduled while this one is still
executing
- it will see the same sequence, will try to cancel the currently executing
task - but that will have no effect (the task will run till completion), and
will try to execute the same tasks again
Does it sound like realistic scenario? Or I am missing something there? If
yes, wondering if we better of using ScheduledExecutor
(https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/ScheduledThreadPoolExecutor.html)
which uses FIFO:
> Delayed tasks execute no sooner than they are enabled, but without any
real-time guarantees about when, after they are enabled, they will commence.
Tasks scheduled for exactly the same execution time are enabled in
first-in-first-out (FIFO) order of submission.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]