Github user trixpan commented on the issue:

    https://github.com/apache/nifi/pull/483
  
    @JPercivall Beautiful code! Loved it. Interesting to see your programming 
thinking. Great lesson (specially because I tried to achieve a similar - though 
more covoluted - logic previously and failed. heheheh)
    
    It makes total sense how you replaced the latch with a timed wait + 
notifyAll.
    
    The only question that I have is how do you deal with a spurious wakeup in 
this section:
    
    ```
     final long serverTimeout = 
context.getProperty(SMTP_TIMEOUT).asTimePeriod(TimeUnit.MILLISECONDS);
                    try {
                        message.wait(serverTimeout);
                    } catch (InterruptedException e) {
                        getLogger().info("Interrupted while waiting for Message 
Handler to acknowledge message.");
                    }
    ```
    
    and this section:
    
    ```
                    try {
                        message.wait(serverTimeout - elapsed);
                    } catch (InterruptedException e) {
                        // Interrupted while waiting for the message to 
process. Will return error and request onTrigger to rollback
                        logger.trace("Interrupted while waiting for processor 
to process data. Returned error to SMTP client as precautionary measure");
    ```
    
    Am I correct to assume you just preferred to ignore them and take a 
decision based on whatever information message object would have gathered by 
that time? Something like: 
    
    if all completed by then, great, message gets acked, commited, client gets 
happy, but if message is partially processed (e.g. no returnCode when it hits 
the first wait above) test with resultCodeSetAndIsError and effectively treat 
it as success(commit) unless an error code is set?
    



---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to