Resilient to Email server failures

git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portal/social-mail-servlet@144139 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Massimiliano Assante 2017-02-22 16:04:00 +00:00
parent 178215ced7
commit 17d7654b02
2 changed files with 7 additions and 5 deletions

View File

@ -2,10 +2,12 @@
<Changeset component="org.gcube.portal.social-mail-servlet.2-1-1" <Changeset component="org.gcube.portal.social-mail-servlet.2-1-1"
date="2017-02-03"> date="2017-02-03">
<Change>Minor refactor for comment replies</Change> <Change>Minor refactor for comment replies</Change>
<Change>Resilient to Email server failures</Change>
</Changeset> </Changeset>
<Changeset component="org.gcube.portal.social-mail-servlet.2-1-0" <Changeset component="org.gcube.portal.social-mail-servlet.2-1-0"
date="2016-08-31"> date="2016-08-31">
<Change>Added possibility to change poller time at runtime as well as to quit it by editing a property file in the server</Change> <Change>Added possibility to change poller time at runtime as well as
to quit it by editing a property file in the server</Change>
<Change>Added support for Auth2</Change> <Change>Added support for Auth2</Change>
</Changeset> </Changeset>
<Changeset component="org.gcube.portal.social-mail-servlet.1-4-0" <Changeset component="org.gcube.portal.social-mail-servlet.1-4-0"

View File

@ -96,9 +96,9 @@ public class PeriodicTask implements Runnable {
public void run() { public void run() {
boolean keepPolling = true; boolean keepPolling = true;
while (keepPolling) { while (keepPolling) {
_log.debug("PeriodicTask starting for portal/site having name: " + popAccount.getPortalName());
check(popAccount.getPortalName(), popAccount.getPop3Server(), popAccount.getPop3user(), popAccount.getPop3password());
try { try {
_log.debug("PeriodicTask starting for portal/site having name: " + popAccount.getPortalName());
check(popAccount.getPortalName(), popAccount.getPop3Server(), popAccount.getPop3user(), popAccount.getPop3password());
int pollingInterval = getPollingInterval(); int pollingInterval = getPollingInterval();
if (pollingInterval > 0) { if (pollingInterval > 0) {
_log.debug("EmailParser restarts in " + pollingInterval + " minutes, to change this polling delay edit gcube-data.properties file under $CATALINA_HOME/conf"); _log.debug("EmailParser restarts in " + pollingInterval + " minutes, to change this polling delay edit gcube-data.properties file under $CATALINA_HOME/conf");
@ -108,7 +108,7 @@ public class PeriodicTask implements Runnable {
_log.info("EmailParser stopped for " + popAccount.getPortalName() + ", found value less than 1 in gcube-data.properties file under $CATALINA_HOME/conf"); _log.info("EmailParser stopped for " + popAccount.getPortalName() + ", found value less than 1 in gcube-data.properties file under $CATALINA_HOME/conf");
keepPolling = false; keepPolling = false;
} }
} catch (InterruptedException e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
} }
@ -191,7 +191,7 @@ public class PeriodicTask implements Runnable {
userRoles.add(DEFAULT_ROLE); userRoles.add(DEFAULT_ROLE);
session.setSecurityToken(null); session.setSecurityToken(null);
String token = authorizationService().generateUserToken(new UserInfo(session.getUsername(), userRoles), scope); String token = authorizationService().generateUserToken(new UserInfo(session.getUsername(), userRoles), scope);
_log.debug("received token: "+token); _log.debug("received token: "+token);
session.setSecurityToken(token); session.setSecurityToken(token);
_log.debug("PeriodicTask EmailParser: Security token set in session for: "+username + " on " + scope); _log.debug("PeriodicTask EmailParser: Security token set in session for: "+username + " on " + scope);