noel        2003/06/06 16:53:34

  Modified:    src/java/org/apache/james/transport/mailets Tag:
                        branch_2_1_fcs RemoteDelivery.java
  Log:
  If send failure and no successful sends, try other servers on the list.  Also 
extended period when we wait for HELLO_NAME to be registered
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.33.4.11 +19 -4     
jakarta-james/src/java/org/apache/james/transport/mailets/RemoteDelivery.java
  
  Index: RemoteDelivery.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-james/src/java/org/apache/james/transport/mailets/RemoteDelivery.java,v
  retrieving revision 1.33.4.10
  retrieving revision 1.33.4.11
  diff -u -r1.33.4.10 -r1.33.4.11
  --- RemoteDelivery.java       27 May 2003 02:41:54 -0000      1.33.4.10
  +++ RemoteDelivery.java       6 Jun 2003 23:53:34 -0000       1.33.4.11
  @@ -358,6 +358,17 @@
                                         .append(outgoingMailServer);
                       log(logMessageBuffer.toString());
                       return true;
  +                } catch (SendFailedException sfe) {
  +                    if (sfe.getValidSentAddresses() == null
  +                          || sfe.getValidSentAddresses().length < 1) {
  +                        if (isDebug) log("Send failed, continuing with any other 
servers");
  +                        lastError = sfe;
  +                        continue;
  +                    } else {
  +                        // If any mail was sent then the outgoing
  +                        // server config must be ok, therefore rethrow
  +                        throw sfe;
  +                    }
                   } catch (MessagingException me) {
                       //MessagingException are horribly difficult to figure out what 
actually happened.
                       StringBuffer exceptionBuffer =
  @@ -723,9 +734,13 @@
            * measure, I'm inserting this philosophically unsatisfactory
            * fix.
            */
  -        try {
  -            Thread.sleep(5000);
  -        } catch (Exception ignored) {} // wait for James to finish initializing
  +        long stop = System.currentTimeMillis() + 60000;
  +        while ((getMailetContext().getAttribute(Constants.HELLO_NAME) == null)
  +               && stop > System.currentTimeMillis()) {
  +            try {
  +                Thread.sleep(1000);
  +            } catch (Exception ignored) {} // wait for James to finish initializing
  +        }
   
           //Checks the pool and delivers a mail message
           Properties props = new Properties();
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to