From: Kab <ka...@us...> - 2004-05-12 20:36:11
|
User: kabkhan Date: 04/05/12 13:36:02 Added: src/java/org/jboss/mail/message MailRetryWrapper.java Log: Made changes for retry Revision Changes Path 1.1 jboss-mail/src/java/org/jboss/mail/message/MailRetryWrapper.java Index: MailRetryWrapper.java =================================================================== /* * JBoss, the OpenSource J2EE webOS * * Distributable under LGPL license. * See terms of license at gnu.org. */ package org.jboss.mail.message; import java.util.List; /** * Thin wrapper around the Mail class to handle things like SMTP retries etc. * The idea is that the first time a mail fails the mailhandlers create an instance of * this class and send the message bak to the maillistener that initiated the request. * The message is then retried with the wrapper. The same wrapper instance is then used on * following attempts. * The to address of the wrapper contains the recipients we were not yet able to send to. * @author Kabir Khan * * */ public class MailRetryWrapper extends Mail { /** The number of retries attmpted so far */ int retries; /** Whether the local or remote envelope tos should be retried (since Remote- and * LocalDeliveryMDB know nothing about each other)*/ int redeliveryDestination; public static int REDELIVERY_LOCAL = 1; public static int REDELIVERY_REMOTE = 2; public MailRetryWrapper(Mail mail, int dest) throws IllegalArgumentException{ super.to = mail.to; this.from = mail.from; this.ih = mail.ih; this.body = mail.body; if (dest != REDELIVERY_LOCAL && dest != REDELIVERY_REMOTE){ throw new IllegalArgumentException("dest must be REDELIVERY_LOCAL (1) or REDELIVERY_REMOTE (2)"); } this.redeliveryDestination = dest; } public void setTos(List tos){ super.to = tos; } public void increaseRetries(){ retries++; } public int getRetryNumber(){ return retries; } public int getRedeliveryDestination(){ return redeliveryDestination; } } |