You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by jg...@apache.org on 2020/05/14 15:50:13 UTC
[tomee-chatterbox] branch master updated: Ensure we close the store
when we have finished with it
This is an automated email from the ASF dual-hosted git repository.
jgallimore pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tomee-chatterbox.git
The following commit(s) were added to refs/heads/master by this push:
new 85ac5cc Ensure we close the store when we have finished with it
85ac5cc is described below
commit 85ac5cc2e1be649e0b8ef051c711847185ab94e2
Author: Jonathan Gallimore <jo...@jrg.me.uk>
AuthorDate: Thu May 14 16:49:05 2020 +0100
Ensure we close the store when we have finished with it
---
.../apache/tomee/chatterbox/imap/adapter/ImapCheckThread.java | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/chatterbox-imap/chatterbox-imap-impl/src/main/java/org/apache/tomee/chatterbox/imap/adapter/ImapCheckThread.java b/chatterbox-imap/chatterbox-imap-impl/src/main/java/org/apache/tomee/chatterbox/imap/adapter/ImapCheckThread.java
index 9f784bf..8a1ac54 100644
--- a/chatterbox-imap/chatterbox-imap-impl/src/main/java/org/apache/tomee/chatterbox/imap/adapter/ImapCheckThread.java
+++ b/chatterbox-imap/chatterbox-imap-impl/src/main/java/org/apache/tomee/chatterbox/imap/adapter/ImapCheckThread.java
@@ -65,12 +65,21 @@ public class ImapCheckThread extends Thread {
@Override
public void run() {
while (!stopped.get()) {
+ Store store = null;
try {
- final Store store = connect(session, resourceAdapter);
+ store = connect(session, resourceAdapter);
processFolder(store, "inbox");
} catch (MessagingException e) {
LOGGER.log(Level.WARNING, String.format("Failed to Connect %s %s: %s",
resourceAdapter, e.getClass().getName(), e.getMessage()));
+ } finally {
+ if (store != null) {
+ try {
+ store.close();
+ } catch (Exception e) {
+ LOGGER.log(Level.WARNING, "Unable to close store" , e);
+ }
+ }
}
try {