Use getMaxActiveSessions() in Tomcat metrics

Replace the getMaxActive() call with getMaxActiveSessions().

Fixes gh-1902
pull/1923/head
Phillip Webb 10 years ago
parent 4840d2c88c
commit 0a6c635f5e

@ -24,6 +24,7 @@ import java.util.List;
import org.apache.catalina.Container;
import org.apache.catalina.Context;
import org.apache.catalina.Manager;
import org.apache.catalina.session.ManagerBase;
import org.springframework.beans.BeansException;
import org.springframework.boot.actuate.metrics.Metric;
import org.springframework.boot.context.embedded.EmbeddedServletContainer;
@ -74,12 +75,18 @@ public class TomcatPublicMetrics implements PublicMetrics, ApplicationContextAwa
private Collection<Metric<?>> metrics(Manager manager) {
List<Metric<?>> metrics = new ArrayList<Metric<?>>(2);
metrics.add(new Metric<Integer>("httpsessions.max", manager.getMaxActive()));
metrics.add(new Metric<Integer>("httpsessions.active", manager
.getActiveSessions()));
if (manager instanceof ManagerBase) {
addMetric(metrics, "httpsessions.max",
((ManagerBase) manager).getMaxActiveSessions());
}
addMetric(metrics, "httpsessions.active", manager.getActiveSessions());
return metrics;
}
private void addMetric(List<Metric<?>> metrics, String name, Integer value) {
metrics.add(new Metric<Integer>(name, value));
}
@Override
public void setApplicationContext(ApplicationContext applicationContext)
throws BeansException {

Loading…
Cancel
Save