SessionMonitoringTimingStore.java revision 0f7c5b88fd04e25bea6113dfc783a05e4e2045f8
152N/A/*
152N/A* The contents of this file are subject to the terms of the Common Development and
152N/A* Distribution License (the License). You may not use this file except in compliance with the
152N/A* License.
152N/A*
152N/A* You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
152N/A* specific language governing permission and limitations under the License.
152N/A*
152N/A* When distributing Covered Software, include this CDDL Header Notice in each file and include
152N/A* the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
152N/A* Header, with the fields enclosed by brackets [] replaced by your own identifying
152N/A* information: "Portions copyright [year] [name of copyright owner]".
152N/A*
152N/A* Copyright 2014 ForgeRock AS.
152N/A*/
152N/Apackage com.iplanet.dpro.session.monitoring;
152N/A
152N/Aimport javax.inject.Inject;
152N/Aimport org.forgerock.openam.shared.monitoring.AbstractTimingStore;
152N/A
152N/A/**
152N/A * An implementation of a timing store specific to the needs of the session monitoring component.
152N/A * Added values are wrapped in a {@link SessionTimingEntry}.
152N/A */
152N/Apublic class SessionMonitoringTimingStore extends AbstractTimingStore {
152N/A
152N/A @Inject
152N/A public SessionMonitoringTimingStore(SessionMonitoringService monitoringService) {
152N/A this(monitoringService.getSessionWindowSize());
481N/A }
481N/A
152N/A /**
* Constructs a SessionMonitoringTimingStore with the provided maximum number of entries in its sample window.
*
* @param maxEntries the maximum number of samples to consider when performing oeprations on the store
*/
public SessionMonitoringTimingStore(int maxEntries) {
super(maxEntries);
}
/**
* Adds an entry to the timing store, having wrapped the supplied long duration in a
* {@link SessionTimingEntry}.
*
* @param duration the length of time the operation took
*/
public void addTimingEntry(long duration) {
durationStore.add(new SessionTimingEntry(duration));
}
}