Search in sources :

Example 1 with ClusterMonitor

use of com.iplanet.dpro.session.service.cluster.ClusterMonitor in project OpenAM by OpenRock.

the class SessionService method getClusterMonitor.

/**
     * The ClusterMonitor state depends on whether the system is configured for
     * SFO or not. As such, this method is aware of the change in SFO state
     * and triggers a re-initialisation of the ClusterMonitor as required.
     *
     * Note, this method also acts as the lazy initialiser for the ClusterMonitor.
     *
     * Thread Safety: Uses atomic reference to ensure only one thread can modify
     * the reference at any one time.
     *
     * @return A non null instance of the current ClusterMonitor.
     * @throws SessionException If there was an error initialising the ClusterMonitor.
     */
private ClusterMonitor getClusterMonitor() throws SessionException {
    if (!isClusterMonitorValid()) {
        try {
            ClusterMonitor previous = clusterMonitor.getAndSet(resolveClusterMonitor());
            if (previous != null) {
                sessionDebug.message("Previous ClusterMonitor shutdown: {}", previous.getClass().getSimpleName());
                previous.shutdown();
            }
            sessionDebug.message("ClusterMonitor initialised: {}", clusterMonitor.get().getClass().getSimpleName());
        } catch (Exception e) {
            sessionDebug.error("Failed to initialise ClusterMonitor", e);
        }
    }
    ClusterMonitor monitor = clusterMonitor.get();
    if (monitor == null) {
        throw new SessionException("Failed to initialise ClusterMonitor");
    }
    return monitor;
}
Also used : MultiServerClusterMonitor(com.iplanet.dpro.session.service.cluster.MultiServerClusterMonitor) ClusterMonitor(com.iplanet.dpro.session.service.cluster.ClusterMonitor) SingleServerClusterMonitor(com.iplanet.dpro.session.service.cluster.SingleServerClusterMonitor) SessionException(com.iplanet.dpro.session.SessionException) DelegationException(com.sun.identity.delegation.DelegationException) SSOException(com.iplanet.sso.SSOException) InterruptedIOException(java.io.InterruptedIOException) IdRepoException(com.sun.identity.idm.IdRepoException) ConnectException(java.net.ConnectException) SessionException(com.iplanet.dpro.session.SessionException) CoreTokenException(org.forgerock.openam.cts.exceptions.CoreTokenException)

Aggregations

SessionException (com.iplanet.dpro.session.SessionException)1 ClusterMonitor (com.iplanet.dpro.session.service.cluster.ClusterMonitor)1 MultiServerClusterMonitor (com.iplanet.dpro.session.service.cluster.MultiServerClusterMonitor)1 SingleServerClusterMonitor (com.iplanet.dpro.session.service.cluster.SingleServerClusterMonitor)1 SSOException (com.iplanet.sso.SSOException)1 DelegationException (com.sun.identity.delegation.DelegationException)1 IdRepoException (com.sun.identity.idm.IdRepoException)1 InterruptedIOException (java.io.InterruptedIOException)1 ConnectException (java.net.ConnectException)1 CoreTokenException (org.forgerock.openam.cts.exceptions.CoreTokenException)1