use of org.objectweb.proactive.utils.Sleeper in project scheduling by ow2-proactive.
the class SessionsCleaner method run.
public void run() {
while (!stop) {
logger.info("cleaning session started, " + sessionStore.size() + " existing session(s) ");
int removedSession = sessionStore.terminateExpiredSessions(TIMEOUT_DELAY);
// clean every 5 minutes
logger.info("cleaning session ended, " + removedSession + " session(s) removed");
new Sleeper(CLEAN_PERIOD, logger).sleep();
}
logger.info(Thread.currentThread().getName() + " terminated");
}
use of org.objectweb.proactive.utils.Sleeper in project scheduling by ow2-proactive.
the class RMStateCaching method init_.
private static void init_() {
while (rm == null) {
String url = PortalConfiguration.RM_URL.getValueAsString();
String cred_path = PortalConfiguration.RM_CACHE_CREDENTIALS.getValueAsStringOrNull();
try {
if (rm == null) {
rm = PAActiveObject.newActive(RMProxyUserInterface.class, new Object[] {});
if (cred_path != null && !(new File(cred_path)).exists()) {
logger.error("Credentials path set in " + PortalConfiguration.RM_CACHE_CREDENTIALS.getKey() + " but file " + cred_path + " does not exist");
}
if (cred_path != null && new File(cred_path).exists()) {
Credentials cred = Credentials.getCredentials(cred_path);
rm.init(url, cred);
} else {
String login = PortalConfiguration.RM_CACHE_LOGIN.getValueAsString();
String password = PortalConfiguration.RM_CACHE_PASSWORD.getValueAsString();
rm.init(url, new CredData(login, password));
}
}
} catch (Exception e) {
logger.warn("Could not connect to resource manager at " + url + " retrying in 8 seconds", e);
if (rm != null) {
PAActiveObject.terminateActiveObject(rm, true);
rm = null;
}
new Sleeper(8 * 1000, logger).sleep();
continue;
}
}
}
Aggregations