openmeetings-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From solo...@apache.org
Subject svn commit: r1451541 - in /openmeetings/trunk/singlewebapp/src/org/apache/openmeetings: persistence/beans/basic/MailMessage.java utils/mail/MailHandler.java
Date Fri, 01 Mar 2013 09:24:32 GMT
Author: solomax
Date: Fri Mar  1 09:24:31 2013
New Revision: 1451541

URL: http://svn.apache.org/r1451541
Log:
[OPENMEETINGS-327] Max error count is added to mailQ

Modified:
    openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/persistence/beans/basic/MailMessage.java
    openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/utils/mail/MailHandler.java

Modified: openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/persistence/beans/basic/MailMessage.java
URL: http://svn.apache.org/viewvc/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/persistence/beans/basic/MailMessage.java?rev=1451541&r1=1451540&r2=1451541&view=diff
==============================================================================
--- openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/persistence/beans/basic/MailMessage.java
(original)
+++ openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/persistence/beans/basic/MailMessage.java
Fri Mar  1 09:24:31 2013
@@ -46,6 +46,7 @@ public class MailMessage implements IDat
 	public enum Status {
 		NONE
 		, SENDING
+		, ERROR
 		, DONE
 	}
 	
@@ -82,6 +83,9 @@ public class MailMessage implements IDat
 	@Column(name = "updated")
 	private Calendar updated;
 	
+	@Column(name = "errorCount", nullable = false)
+	private int errorCount = 0;
+	
 	public MailMessage(String recipients, String replyTo, String subject, String body) {
 		this(recipients, replyTo, subject, body, null);
 	}
@@ -165,4 +169,12 @@ public class MailMessage implements IDat
 	public void setIcs(byte[] ics) {
 		this.ics = ics;
 	}
+
+	public int getErrorCount() {
+		return errorCount;
+	}
+
+	public void setErrorCount(int errorCount) {
+		this.errorCount = errorCount;
+	}
 }

Modified: openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/utils/mail/MailHandler.java
URL: http://svn.apache.org/viewvc/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/utils/mail/MailHandler.java?rev=1451541&r1=1451540&r2=1451541&view=diff
==============================================================================
--- openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/utils/mail/MailHandler.java
(original)
+++ openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/utils/mail/MailHandler.java
Fri Mar  1 09:24:31 2013
@@ -57,6 +57,7 @@ public class MailHandler {
 	private static final Logger log = Red5LoggerFactory.getLogger(
 			MailHandler.class, OpenmeetingsVariables.webAppRootKey);
 	private static final int MAIL_SEND_TIMEOUT = 60 * 60 * 1000; // 1 hour
+	private static final int MAXIMUM_ERROR_COUNT = 5;
 	
 	@Autowired
 	private ConfigurationDao cfgDao;
@@ -197,7 +198,8 @@ public class MailHandler {
 						m.setStatus(Status.DONE);
 					} catch (Exception e) {
 						log.error("Error while sending message", e);
-						m.setStatus(Status.NONE);
+						m.setErrorCount(m.getErrorCount() + 1);
+						m.setStatus(m.getErrorCount() < MAXIMUM_ERROR_COUNT ? Status.NONE : Status.ERROR);
 					}
 					if (m.getId() != 0) {
 						mailMessageDao.update(m, null);



Mime
View raw message