/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at legal-notices/CDDLv1_0.txt.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information:
* Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*
*
* Copyright 2013-2015 ForgeRock AS
*/
/**
* Collects statistics for HTTP. This class inherits from {@link LDAPStatistics}
* to show the administrator how the underlying LDAP internal operations are
* performing.
*/
{
/**
* Map containing the total number of requests per HTTP methods.
* <p>
* key: HTTP method => value: number of requests for that method.
* </p>
* Not using a ConcurrentMap implementation here because the keys are static.
* The keys are static because they need to be listed in the schema which is
* static.
*/
/**
* Map containing the total execution time for the requests per HTTP methods.
* <p>
* key: HTTP method => value: total execution time for requests using that
* method.
* </p>
* Not using a ConcurrentMap implementation here because the keys are static.
* The keys are static because they need to be listed in the schema which is
* static.
*/
/**
* Total number of requests. The total number may be different than the sum of
* the supported HTTP methods above because clients could use unsupported HTTP
* methods.
*/
/**
* Constructor for this class.
*
* @param instanceName
* The name for this monitor provider instance.
*/
{
super(instanceName);
// List the HTTP methods supported by Rest2LDAP
{
}
}
/** {@inheritDoc} */
public void clearStatistics()
{
this.requestMethodsTotalCount.clear();
this.requestMethodsTotalTime.clear();
super.clearStatistics();
}
/** {@inheritDoc} */
{
// first take a snapshot of all the data as fast as possible
{
}
{
}
// do the same with the underlying data
return results;
}
{
{
}
}
/**
* Adds a request to the stats using the provided HTTP method.
*
* @param httpMethod
* the method of the HTTP request to add to the stats
* @throws NullPointerException
* if the httpMethod is null
*/
{
{
} // else this is an unsupported HTTP method
// always count any requests regardless of whether the method is supported
this.requestsTotalCount.incrementAndGet();
}
/**
* Adds to the total time of an HTTP request method.
*
* @param httpMethod
* the method of the HTTP request to add to the stats
* @param time
* the time to add to the total
* @throws NullPointerException
* if the httpMethod is null
*/
throws NullPointerException
{
{
} // else this is an unsupported HTTP method
}
}