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 2009/10/07 17:32:43 UTC

svn commit: r822779 - /james/hupa/trunk/server/src/main/java/org/apache/hupa/server/InMemoryIMAPStoreCache.java

Author: norman
Date: Wed Oct  7 15:32:43 2009
New Revision: 822779

URL: http://svn.apache.org/viewvc?rev=822779&view=rev
Log:
Take care of reconnect on closed imap socket (HUPA-34) and make sure connections get closed on removal from cache (HUPA-33)

Modified:
    james/hupa/trunk/server/src/main/java/org/apache/hupa/server/InMemoryIMAPStoreCache.java

Modified: james/hupa/trunk/server/src/main/java/org/apache/hupa/server/InMemoryIMAPStoreCache.java
URL: http://svn.apache.org/viewvc/james/hupa/trunk/server/src/main/java/org/apache/hupa/server/InMemoryIMAPStoreCache.java?rev=822779&r1=822778&r2=822779&view=diff
==============================================================================
--- james/hupa/trunk/server/src/main/java/org/apache/hupa/server/InMemoryIMAPStoreCache.java (original)
+++ james/hupa/trunk/server/src/main/java/org/apache/hupa/server/InMemoryIMAPStoreCache.java Wed Oct  7 15:32:43 2009
@@ -86,9 +86,19 @@
 			cstore = createCachedIMAPStore();
 		} else {
 			if (cstore.isExpired() == false) {
-				cstore.validate();
+			    try {
+			        cstore.validate();
+			    } catch (MessagingException e) {
+			        
+			        cstore = createCachedIMAPStore();
+			    }
 			} else {
 				pool.remove(username);
+				try {
+				    if (cstore != null) cstore.getStore().close();
+				} catch (MessagingException e) {
+				    // ignore on close
+				}
 				cstore = createCachedIMAPStore();
 			}
 		}
@@ -154,7 +164,7 @@
 		}
 		
 		public boolean isExpired() {
-			if (validTo < System.currentTimeMillis()) {
+			if (validTo < System.currentTimeMillis() && store.isConnected()) {
 				return false;
 			}
 			return true;



---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org