You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by no...@apache.org on 2003/06/07 01:43:09 UTC

cvs commit: jakarta-james/src/java/org/apache/james/transport/mailets RemoteDelivery.java

noel        2003/06/06 16:43:09

  Modified:    src/java/org/apache/james/transport/mailets
                        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
  1.50      +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.49
  retrieving revision 1.50
  diff -u -r1.49 -r1.50
  --- RemoteDelivery.java	27 May 2003 03:02:22 -0000	1.49
  +++ RemoteDelivery.java	6 Jun 2003 23:43:08 -0000	1.50
  @@ -334,6 +334,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 =
  @@ -698,9 +709,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(MailetContextConstants.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: james-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: james-dev-help@jakarta.apache.org