DefaultJMQSAML2Repository.java revision e70418658b6daa84fc8a1f13677d2cb616a66725
067b7cf571968fe8e91212059da1590c2dfa741aJonathan von Schroeder/**
067b7cf571968fe8e91212059da1590c2dfa741aJonathan von Schroeder * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
067b7cf571968fe8e91212059da1590c2dfa741aJonathan von Schroeder *
067b7cf571968fe8e91212059da1590c2dfa741aJonathan von Schroeder * Copyright (c) 2008 Sun Microsystems Inc. All Rights Reserved
97dc615bc3ce381eaa3e75cc23dfc3c4b566d9a0Jonathan von Schroeder *
97dc615bc3ce381eaa3e75cc23dfc3c4b566d9a0Jonathan von Schroeder * The contents of this file are subject to the terms
97dc615bc3ce381eaa3e75cc23dfc3c4b566d9a0Jonathan von Schroeder * of the Common Development and Distribution License
97dc615bc3ce381eaa3e75cc23dfc3c4b566d9a0Jonathan von Schroeder * (the License). You may not use this file except in
97dc615bc3ce381eaa3e75cc23dfc3c4b566d9a0Jonathan von Schroeder * compliance with the License.
97dc615bc3ce381eaa3e75cc23dfc3c4b566d9a0Jonathan von Schroeder *
97dc615bc3ce381eaa3e75cc23dfc3c4b566d9a0Jonathan von Schroeder * You can obtain a copy of the License at
97dc615bc3ce381eaa3e75cc23dfc3c4b566d9a0Jonathan von Schroeder * https://opensso.dev.java.net/public/CDDLv1.0.html or
97dc615bc3ce381eaa3e75cc23dfc3c4b566d9a0Jonathan von Schroeder * opensso/legal/CDDLv1.0.txt
97dc615bc3ce381eaa3e75cc23dfc3c4b566d9a0Jonathan von Schroeder * See the License for the specific language governing
97dc615bc3ce381eaa3e75cc23dfc3c4b566d9a0Jonathan von Schroeder * permission and limitations under the License.
97dc615bc3ce381eaa3e75cc23dfc3c4b566d9a0Jonathan von Schroeder *
97dc615bc3ce381eaa3e75cc23dfc3c4b566d9a0Jonathan von Schroeder * When distributing Covered Code, include this CDDL
97dc615bc3ce381eaa3e75cc23dfc3c4b566d9a0Jonathan von Schroeder * Header Notice in each file and include the License file
97dc615bc3ce381eaa3e75cc23dfc3c4b566d9a0Jonathan von Schroeder * at opensso/legal/CDDLv1.0.txt.
97dc615bc3ce381eaa3e75cc23dfc3c4b566d9a0Jonathan von Schroeder * If applicable, add the following below the CDDL Header,
97dc615bc3ce381eaa3e75cc23dfc3c4b566d9a0Jonathan von Schroeder * with the fields enclosed by brackets [] replaced by
97dc615bc3ce381eaa3e75cc23dfc3c4b566d9a0Jonathan von Schroeder * your own identifying information:
97dc615bc3ce381eaa3e75cc23dfc3c4b566d9a0Jonathan von Schroeder * "Portions Copyrighted [year] [name of copyright owner]"
97dc615bc3ce381eaa3e75cc23dfc3c4b566d9a0Jonathan von Schroeder *
067b7cf571968fe8e91212059da1590c2dfa741aJonathan von Schroeder * $Id: DefaultJMQSAML2Repository.java,v 1.5 2008/08/01 22:23:47 hengming Exp $
067b7cf571968fe8e91212059da1590c2dfa741aJonathan von Schroeder *
97dc615bc3ce381eaa3e75cc23dfc3c4b566d9a0Jonathan von Schroeder */
067b7cf571968fe8e91212059da1590c2dfa741aJonathan von Schroeder
067b7cf571968fe8e91212059da1590c2dfa741aJonathan von Schroederpackage com.sun.identity.saml2.plugins;
067b7cf571968fe8e91212059da1590c2dfa741aJonathan von Schroeder
97dc615bc3ce381eaa3e75cc23dfc3c4b566d9a0Jonathan von Schroederimport com.sun.identity.common.SystemTimer;
97dc615bc3ce381eaa3e75cc23dfc3c4b566d9a0Jonathan von Schroeder
97dc615bc3ce381eaa3e75cc23dfc3c4b566d9a0Jonathan von Schroederimport com.sun.identity.common.GeneralTaskRunnable;
7bbfb15142ab4286dfc6fcde2fc94a5512297e41Jonathan von Schroeder
7bbfb15142ab4286dfc6fcde2fc94a5512297e41Jonathan von Schroederimport com.iplanet.dpro.session.SessionException;
067b7cf571968fe8e91212059da1590c2dfa741aJonathan von Schroederimport com.sun.identity.shared.configuration.SystemPropertiesManager;
067b7cf571968fe8e91212059da1590c2dfa741aJonathan von Schroeder
067b7cf571968fe8e91212059da1590c2dfa741aJonathan von Schroederimport com.iplanet.dpro.session.service.SessionService;
067b7cf571968fe8e91212059da1590c2dfa741aJonathan von Schroederimport com.iplanet.dpro.session.share.SessionBundle;
97dc615bc3ce381eaa3e75cc23dfc3c4b566d9a0Jonathan von Schroederimport com.iplanet.services.naming.WebtopNaming;
067b7cf571968fe8e91212059da1590c2dfa741aJonathan von Schroederimport com.sun.identity.session.util.SessionUtils;
067b7cf571968fe8e91212059da1590c2dfa741aJonathan von Schroederimport com.sun.identity.shared.Constants;
067b7cf571968fe8e91212059da1590c2dfa741aJonathan von Schroederimport com.sun.identity.shared.debug.Debug;
97dc615bc3ce381eaa3e75cc23dfc3c4b566d9a0Jonathan von Schroederimport java.util.ArrayList;
97dc615bc3ce381eaa3e75cc23dfc3c4b566d9a0Jonathan von Schroederimport java.util.Date;
97dc615bc3ce381eaa3e75cc23dfc3c4b566d9a0Jonathan von Schroederimport java.util.List;
97dc615bc3ce381eaa3e75cc23dfc3c4b566d9a0Jonathan von Schroederimport java.util.Map;
97dc615bc3ce381eaa3e75cc23dfc3c4b566d9a0Jonathan von Schroederimport java.util.Vector;
97dc615bc3ce381eaa3e75cc23dfc3c4b566d9a0Jonathan von Schroederimport javax.jms.IllegalStateException;
067b7cf571968fe8e91212059da1590c2dfa741aJonathan von Schroederimport org.forgerock.openam.session.model.FAMRecord;
067b7cf571968fe8e91212059da1590c2dfa741aJonathan von Schroederimport com.sun.identity.ha.FAMRecordPersister;
067b7cf571968fe8e91212059da1590c2dfa741aJonathan von Schroederimport com.sun.identity.ha.FAMPersisterManager;
97dc615bc3ce381eaa3e75cc23dfc3c4b566d9a0Jonathan von Schroederimport com.sun.identity.saml2.common.SAML2Utils;
97dc615bc3ce381eaa3e75cc23dfc3c4b566d9a0Jonathan von Schroeder
067b7cf571968fe8e91212059da1590c2dfa741aJonathan von Schroeder
067b7cf571968fe8e91212059da1590c2dfa741aJonathan von Schroeder/**
22b772f8753f0cdb4508ba460356c238de2ee375Jonathan von Schroeder * This class is used in SAML2 failover mode to store/recover serialized
22b772f8753f0cdb4508ba460356c238de2ee375Jonathan von Schroeder * state of Assertion/Response object
22b772f8753f0cdb4508ba460356c238de2ee375Jonathan von Schroeder */
97dc615bc3ce381eaa3e75cc23dfc3c4b566d9a0Jonathan von Schroederpublic class DefaultJMQSAML2Repository extends GeneralTaskRunnable
067b7cf571968fe8e91212059da1590c2dfa741aJonathan von Schroeder implements JMQSAML2Repository {
067b7cf571968fe8e91212059da1590c2dfa741aJonathan von Schroeder
067b7cf571968fe8e91212059da1590c2dfa741aJonathan von Schroeder /* Operations */
067b7cf571968fe8e91212059da1590c2dfa741aJonathan von Schroeder static public final String READ = "READ";
067b7cf571968fe8e91212059da1590c2dfa741aJonathan von Schroeder
97dc615bc3ce381eaa3e75cc23dfc3c4b566d9a0Jonathan von Schroeder static public final String WRITE = "WRITE";
067b7cf571968fe8e91212059da1590c2dfa741aJonathan von Schroeder
067b7cf571968fe8e91212059da1590c2dfa741aJonathan von Schroeder static public final String DELETE = "DELETE";
067b7cf571968fe8e91212059da1590c2dfa741aJonathan von Schroeder
97dc615bc3ce381eaa3e75cc23dfc3c4b566d9a0Jonathan von Schroeder static public final String DELETEBYDATE = "DELETEBYDATE";
97dc615bc3ce381eaa3e75cc23dfc3c4b566d9a0Jonathan von Schroeder
97dc615bc3ce381eaa3e75cc23dfc3c4b566d9a0Jonathan von Schroeder
97dc615bc3ce381eaa3e75cc23dfc3c4b566d9a0Jonathan von Schroeder // Private data members
7bbfb15142ab4286dfc6fcde2fc94a5512297e41Jonathan von Schroeder String serverId;
7bbfb15142ab4286dfc6fcde2fc94a5512297e41Jonathan von Schroeder
97dc615bc3ce381eaa3e75cc23dfc3c4b566d9a0Jonathan von Schroeder /* Config data */
6516023b9db74939c0a0f79fd6cc5bc7d9bab382Jonathan von Schroeder private static boolean isDatabaseUp = true;
067b7cf571968fe8e91212059da1590c2dfa741aJonathan von Schroeder
97dc615bc3ce381eaa3e75cc23dfc3c4b566d9a0Jonathan von Schroeder /**
97dc615bc3ce381eaa3e75cc23dfc3c4b566d9a0Jonathan von Schroeder * grace period before expired session records are removed from the
97dc615bc3ce381eaa3e75cc23dfc3c4b566d9a0Jonathan von Schroeder * repository
97dc615bc3ce381eaa3e75cc23dfc3c4b566d9a0Jonathan von Schroeder */
97dc615bc3ce381eaa3e75cc23dfc3c4b566d9a0Jonathan von Schroeder private static long gracePeriod = 5 * 60; /* 5 mins in secs */
97dc615bc3ce381eaa3e75cc23dfc3c4b566d9a0Jonathan von Schroeder
97dc615bc3ce381eaa3e75cc23dfc3c4b566d9a0Jonathan von Schroeder private static final String CLEANUP_GRACE_PERIOD =
97dc615bc3ce381eaa3e75cc23dfc3c4b566d9a0Jonathan von Schroeder "com.sun.identity.session.repository.cleanupGracePeriod";
97dc615bc3ce381eaa3e75cc23dfc3c4b566d9a0Jonathan von Schroeder
97dc615bc3ce381eaa3e75cc23dfc3c4b566d9a0Jonathan von Schroeder private static final String BRIEF_DB_ERROR_MSG =
97dc615bc3ce381eaa3e75cc23dfc3c4b566d9a0Jonathan von Schroeder "SAML2 failover service is not functional due to DB unavailability.";
97dc615bc3ce381eaa3e75cc23dfc3c4b566d9a0Jonathan von Schroeder
97dc615bc3ce381eaa3e75cc23dfc3c4b566d9a0Jonathan von Schroeder private static final String DB_ERROR_MSG =
97dc615bc3ce381eaa3e75cc23dfc3c4b566d9a0Jonathan von Schroeder "SAML2 database is not available at this moment."
97dc615bc3ce381eaa3e75cc23dfc3c4b566d9a0Jonathan von Schroeder + "Please check with the system administrator " +
97dc615bc3ce381eaa3e75cc23dfc3c4b566d9a0Jonathan von Schroeder "for appropriate actions";
97dc615bc3ce381eaa3e75cc23dfc3c4b566d9a0Jonathan von Schroeder
97dc615bc3ce381eaa3e75cc23dfc3c4b566d9a0Jonathan von Schroeder private static final String LOG_MSG_DB_BACK_ONLINE =
97dc615bc3ce381eaa3e75cc23dfc3c4b566d9a0Jonathan von Schroeder "SESSION_DATABASE_BACK_ONLINE";
97dc615bc3ce381eaa3e75cc23dfc3c4b566d9a0Jonathan von Schroeder
97dc615bc3ce381eaa3e75cc23dfc3c4b566d9a0Jonathan von Schroeder private static final String LOG_MSG_DB_UNAVAILABLE =
97dc615bc3ce381eaa3e75cc23dfc3c4b566d9a0Jonathan von Schroeder "SESSION_DATABASE_UNAVAILABLE";
97dc615bc3ce381eaa3e75cc23dfc3c4b566d9a0Jonathan von Schroeder
97dc615bc3ce381eaa3e75cc23dfc3c4b566d9a0Jonathan von Schroeder private static boolean lastLoggedDBStatusIsUp = true;
97dc615bc3ce381eaa3e75cc23dfc3c4b566d9a0Jonathan von Schroeder
97dc615bc3ce381eaa3e75cc23dfc3c4b566d9a0Jonathan von Schroeder /**
97dc615bc3ce381eaa3e75cc23dfc3c4b566d9a0Jonathan von Schroeder * Time period between two successive runs of repository cleanup thread
97dc615bc3ce381eaa3e75cc23dfc3c4b566d9a0Jonathan von Schroeder * which checks and removes expired records
97dc615bc3ce381eaa3e75cc23dfc3c4b566d9a0Jonathan von Schroeder */
97dc615bc3ce381eaa3e75cc23dfc3c4b566d9a0Jonathan von Schroeder
97dc615bc3ce381eaa3e75cc23dfc3c4b566d9a0Jonathan von Schroeder private static long cleanUpPeriod = 5 * 60 * 1000; // 5 min in milliseconds
97dc615bc3ce381eaa3e75cc23dfc3c4b566d9a0Jonathan von Schroeder
97dc615bc3ce381eaa3e75cc23dfc3c4b566d9a0Jonathan von Schroeder private static long cleanUpValue = 0;
97dc615bc3ce381eaa3e75cc23dfc3c4b566d9a0Jonathan von Schroeder
97dc615bc3ce381eaa3e75cc23dfc3c4b566d9a0Jonathan von Schroeder public static final String CLEANUP_RUN_PERIOD =
97dc615bc3ce381eaa3e75cc23dfc3c4b566d9a0Jonathan von Schroeder "com.sun.identity.saml2.repository.cleanupRunPeriod";
97dc615bc3ce381eaa3e75cc23dfc3c4b566d9a0Jonathan von Schroeder
97dc615bc3ce381eaa3e75cc23dfc3c4b566d9a0Jonathan von Schroeder /**
97dc615bc3ce381eaa3e75cc23dfc3c4b566d9a0Jonathan von Schroeder * Time period between two successive runs of DBHealthChecker thread which
97dc615bc3ce381eaa3e75cc23dfc3c4b566d9a0Jonathan von Schroeder * checks for Database availability.
*/
private static long healthCheckPeriod = 1 * 60 * 1000;
public static final String HEALTH_CHECK_RUN_PERIOD =
"com.sun.identity.saml2.repository.healthCheckRunPeriod";
/**
* This period is actual one that is used by the thread. The value is set to
* the smallest value of cleanUPPeriod and healthCheckPeriod.
*/
private static long runPeriod = 1 * 60 * 1000; // 1 min in milliseconds
static Debug debug = SAML2Utils.debug;
private String SAML2="saml2";
static {
try {
gracePeriod = Integer.parseInt(SystemPropertiesManager.get(
CLEANUP_GRACE_PERIOD, String.valueOf(gracePeriod)));
} catch (Exception e) {
debug.error("Invalid value for " + CLEANUP_GRACE_PERIOD
+ ", using default");
}
try {
cleanUpPeriod = Integer.parseInt(SystemPropertiesManager.get(
CLEANUP_RUN_PERIOD, String.valueOf(cleanUpPeriod)));
} catch (Exception e) {
debug.error("Invalid value for " + CLEANUP_RUN_PERIOD
+ ", using default");
}
try {
healthCheckPeriod = Integer
.parseInt(SystemPropertiesManager.get(HEALTH_CHECK_RUN_PERIOD,
String.valueOf(healthCheckPeriod)));
} catch (Exception e) {
debug.error("Invalid value for " + HEALTH_CHECK_RUN_PERIOD
+ ", using default");
}
runPeriod = (cleanUpPeriod <= healthCheckPeriod) ? cleanUpPeriod
: healthCheckPeriod;
cleanUpValue = cleanUpPeriod;
}
// Message queues
// One REQUEST queue/topic is suffcient
// Multiple RESPONSE queues/topics may be necessary
public FAMRecordPersister pSession = null;
/**
*
* Constructs new JMQSAML2Repository
* @exception Exception when cannot create a new SAML2 repository
*
*/
public DefaultJMQSAML2Repository() throws Exception {
String thisSessionServerProtocol = SystemPropertiesManager
.get(Constants.AM_SERVER_PROTOCOL);
String thisSessionServer = SystemPropertiesManager
.get(Constants.AM_SERVER_HOST);
String thisSessionServerPortAsString = SystemPropertiesManager
.get(Constants.AM_SERVER_PORT);
String thisSessionURI = SystemPropertiesManager
.get(Constants.AM_SERVICES_DEPLOYMENT_DESCRIPTOR);
if (thisSessionServerProtocol == null
|| thisSessionServerPortAsString == null
|| thisSessionServer == null) {
throw new SessionException(SessionBundle.rbName,
"propertyMustBeSet", null);
}
serverId = WebtopNaming.getServerID(thisSessionServerProtocol,
thisSessionServer, thisSessionServerPortAsString,
thisSessionURI);
initPersistSession();
SystemTimer.getTimer().schedule(this, new Date((
System.currentTimeMillis() / 1000) * 1000));
}
/**
*
* Initialize new FAMRecord persister
*/
private void initPersistSession() {
try {
pSession = FAMPersisterManager.getInstance().
getFAMRecordPersister();
isDatabaseUp = true;
} catch (Exception e) {
isDatabaseUp = false;
debug.error(BRIEF_DB_ERROR_MSG);
if (debug.messageEnabled()) {
debug.message(DB_ERROR_MSG, e);
}
}
}
/**
* Retrives existing SAML2 object from persistent datastore
* @param samlKey primary key
* @return SAML2 object, if failed, return null.
*/
public Object retrieve(String samlKey) {
if (!isDatabaseUp) {
return null;
}
try {
FAMRecord famRec = new FAMRecord (
SAML2, FAMRecord.READ, samlKey, 0, null, 0, null, null);
FAMRecord retRec = pSession.send(famRec);
byte[] blob = retRec.getSerializedInternalSessionBlob();
Object retObj = SessionUtils.decode(blob);
return retObj;
} catch (IllegalStateException e) {
isDatabaseUp = false;
logDBStatus();
debug.error(BRIEF_DB_ERROR_MSG, e);
if (debug.messageEnabled()) {
debug.message(DB_ERROR_MSG, e);
}
return null;
} catch (Exception e) {
debug.message("JMQSAML2Repository.retrieve(): failed retrieving "
+ "SAML2 object", e);
return null;
}
}
/**
* Retrives a list of existing SAML2 object from persistent datastore with
* secodaryKey
*
* @param secKey Secondary Key
* @return SAML2 object, if failed, return null.
*/
public List retrieveWithSecondaryKey(String secKey) {
if (!isDatabaseUp) {
return null;
}
try {
FAMRecord famRec = new FAMRecord(SAML2,
FAMRecord.READ_WITH_SEC_KEY, null, 0, secKey, 0, null, null);
FAMRecord retRec = pSession.send(famRec);
Map map = retRec.getExtraStringAttributes();
if ((map != null) && (!map.isEmpty())) {
Vector blobs = (Vector)map.values().iterator().next();
if ((blobs != null) && (!blobs.isEmpty())) {
List list = new ArrayList();
for(int i=0; i<blobs.size(); i++) {
byte[] blob = (byte[])blobs.get(i);
Object obj = SessionUtils.decode(blob);
list.add(obj);
}
return list;
}
}
return null;
} catch (IllegalStateException e) {
isDatabaseUp = false;
logDBStatus();
debug.error(BRIEF_DB_ERROR_MSG, e);
if (debug.messageEnabled()) {
debug.message(DB_ERROR_MSG, e);
}
return null;
} catch (Exception e) {
debug.message("JMQSAML2Repository.retrieve(): failed retrieving "
+ "SAML2 object", e);
return null;
}
}
/**
* Deletes the SAML2 object by given primary key from the repository
* @param samlKey primary key
*/
public void delete(String samlKey) {
if (!isDatabaseUp) {
return;
}
try {
FAMRecord famRec = new FAMRecord (
SAML2, FAMRecord.DELETE, samlKey, 0, null, 0, null, null);
FAMRecord retRec = pSession.send(famRec);
} catch (IllegalStateException e) {
isDatabaseUp = false;
logDBStatus();
debug.error(BRIEF_DB_ERROR_MSG, e);
if (debug.messageEnabled()) {
debug.message(DB_ERROR_MSG, e);
}
} catch (Exception e) {
debug.error("JMQSAML2Repository.delete(): failed deleting "
+ "SAML2 object", e);
}
}
/**
* Deletes expired SAML2 object from the repository
* @exception Exception When Unable to delete the expired SAML2 object
*/
public void deleteExpired() {
if (!isDatabaseUp) {
return;
}
try {
long date = System.currentTimeMillis() / 1000;
FAMRecord famRec = new FAMRecord (
SAML2, FAMRecord.DELETEBYDATE, null,
date, null, 0, null, null);
FAMRecord retRec = pSession.send(famRec);
} catch (IllegalStateException e) {
isDatabaseUp = false;
logDBStatus();
debug.error(BRIEF_DB_ERROR_MSG, e);
if (debug.messageEnabled()) {
debug.message(DB_ERROR_MSG, e);
}
} catch (Exception e) {
debug.error("JMQSAML2Repository.deleteExpired(): failed "
+ "deleting Expired saml2 object", e);
}
}
/**
* Saves SAML2 data into the SAML2 Repository
* @param samlKey primary key
* @param samlObj saml object such as Response, IDPSession
* @param expirationTime expiration time
* @param secKey Secondary Key
*/
public void save(String samlKey, Object samlObj, long expirationTime,
String secKey) {
if (!isDatabaseUp) {
return;
}
try {
byte[] blob = SessionUtils.encode(samlObj);
FAMRecord famRec = new FAMRecord (
SAML2, FAMRecord.WRITE, samlKey, expirationTime, secKey,
0, null, blob);
FAMRecord retRec = pSession.send(famRec);
} catch (IllegalStateException e) {
isDatabaseUp = false;
logDBStatus();
debug.error(BRIEF_DB_ERROR_MSG, e);
if (debug.messageEnabled()) {
debug.message(DB_ERROR_MSG, e);
}
} catch (Exception e) {
debug.error("JMQSAML2Repository.save(): failed "
+ "to save SAML2 object", e);
}
}
/**
* This method is invoked to log a message in the following two cases:
*
* (1) the DB is detected down by either the user requests
* (retrieve/save/delete) or the background checker thread:
* Log message: HA_DATABASE_UNAVAILABLE (2) the DB is detected
* available again by the background health checker thread => Log message:
* HA_DATABASE_BACK_ONLINE
*
* The flag "lastLoggedDBStatusIsUp" is used to avoid logging the same DB
* status again and again if the status actually doesn't change over time.
*
* Please also note that if the DB is already down in the very beginning
* when starting the AM instance, there will be no message being logged
* since at this time the session service is not fully initialized yet
* therefore no sso token can be generated and used for the logging purpose.
* Nevertheless, the appropriate logging will be done later when the
* background thread kicks in.
*
*/
private void logDBStatus() {
SessionService ss = SessionService.getSessionService();
if (!isDatabaseUp && lastLoggedDBStatusIsUp) {
ss.logSystemMessage(LOG_MSG_DB_UNAVAILABLE,
java.util.logging.Level.WARNING);
lastLoggedDBStatusIsUp = false;
}
if (isDatabaseUp && !lastLoggedDBStatusIsUp) {
ss.logSystemMessage(LOG_MSG_DB_BACK_ONLINE,
java.util.logging.Level.INFO);
lastLoggedDBStatusIsUp = true;
}
}
public long getRunPeriod() {
return runPeriod;
}
public boolean addElement(Object obj) {
return false;
}
public boolean removeElement(Object obj) {
return false;
}
public boolean isEmpty() {
return true;
}
/**
* Monitoring logic used by background thread This thread is used for both
* clenup expired sessions in the repository and for the Database health
* checking. The thread always runs with smallest value of cleanUpPeriod and
* healthCheckPeriod.
*/
public void run() {
String classMethod="DefaultJMQSAML2Repository.run: ";
try {
if (debug.messageEnabled()) {
debug.message(classMethod + "Cleaning expired SAML2 records");
}
/*
* Clean up is done based on the cleanUpPeriod even though the
* thread runs based on the runPeriod.
*/
if (SAML2Utils.isSAML2FailOverEnabled() && (cleanUpValue <= 0)) {
deleteExpired();
cleanUpValue = cleanUpPeriod;
}
cleanUpValue = cleanUpValue - runPeriod;
/*
* HealthChecking is done based on the runPeriod but only when
* the Database is down.
*/
if (SAML2Utils.isSAML2FailOverEnabled() && (!isDatabaseUp)) {
initPersistSession();
logDBStatus();
}
} catch (Exception e) {
debug.error("JMQSAML2Repository.run(): Exception in thread",
e);
}
}
}