Commit d4d1fe7f by Spencer Gibb

cleanup timer thread in zuul filter

parent 5287d5be
......@@ -13,14 +13,13 @@ import java.security.UnrecoverableKeyException;
import java.security.cert.CertificateException;
import java.security.cert.X509Certificate;
import java.util.ArrayList;
import java.util.Collection;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Timer;
import java.util.TimerTask;
import java.util.concurrent.atomic.AtomicReference;
import javax.annotation.PreDestroy;
import javax.net.ssl.SSLContext;
import javax.net.ssl.TrustManager;
import javax.net.ssl.X509TrustManager;
......@@ -86,7 +85,7 @@ public class SimpleHostRoutingFilter extends ZuulFilter {
private static final AtomicReference<HttpClient> CLIENT = new AtomicReference<HttpClient>(
newClient());
private static final Timer CONNECTION_MANAGER_TIMER = new Timer(true);
private static final Timer CONNECTION_MANAGER_TIMER = new Timer("SimpleHostRoutingFilter.CONNECTION_MANAGER_TIMER", true);
// cleans expired connections at an interval
static {
......@@ -139,6 +138,11 @@ public class SimpleHostRoutingFilter extends ZuulFilter {
this.helper = helper;
}
@PreDestroy
public void stop() {
CONNECTION_MANAGER_TIMER.cancel();
}
@Override
public String filterType() {
return "route";
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment