![JAR search and dependency download from the Maven repository](/logo.png)
org.eclipse.jetty.client.LeakTrackingConnectionPool Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of aem-sdk-api Show documentation
Show all versions of aem-sdk-api Show documentation
The Adobe Experience Manager SDK
//
// ========================================================================
// Copyright (c) 1995-2022 Mort Bay Consulting Pty Ltd and others.
// ------------------------------------------------------------------------
// All rights reserved. This program and the accompanying materials
// are made available under the terms of the Eclipse Public License v1.0
// and Apache License v2.0 which accompanies this distribution.
//
// The Eclipse Public License is available at
// http://www.eclipse.org/legal/epl-v10.html
//
// The Apache License v2.0 is available at
// http://www.opensource.org/licenses/apache2.0.php
//
// You may elect to redistribute this code under either of these licenses.
// ========================================================================
//
package org.eclipse.jetty.client;
import org.eclipse.jetty.client.api.Connection;
import org.eclipse.jetty.client.api.Destination;
import org.eclipse.jetty.util.Callback;
import org.eclipse.jetty.util.LeakDetector;
import org.eclipse.jetty.util.component.LifeCycle;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger;
// @deprecated The Eclipse Jetty and Apache Felix Http Jetty packages are no longer supported.
@Deprecated(since = "2021-05-27")
public class LeakTrackingConnectionPool extends DuplexConnectionPool {
private static final Logger LOG = Log.getLogger(LeakTrackingConnectionPool.class);
private final LeakDetector leakDetector = new LeakDetector() {
@Override
protected void leaked(LeakInfo leakInfo) {
LeakTrackingConnectionPool.this.leaked(leakInfo);
}
};
public LeakTrackingConnectionPool(Destination destination, int maxConnections, Callback requester) {
super((HttpDestination) destination, maxConnections, requester);
addBean(leakDetector);
}
@Override
public void close() {
LifeCycle.stop(this);
super.close();
}
@Override
protected void acquired(Connection connection) {
if (!leakDetector.acquired(connection))
LOG.info("Connection {}@{} not tracked", connection, leakDetector.id(connection));
}
@Override
protected void released(Connection connection) {
if (!leakDetector.released(connection))
LOG.info("Connection {}@{} released but not acquired", connection, leakDetector.id(connection));
}
protected void leaked(LeakDetector.LeakInfo leakInfo) {
LOG.info("Connection " + leakInfo.getResourceDescription() + " leaked at:", leakInfo.getStackFrames());
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy