
net.lightbody.bmp.proxy.http.HttpClientInterrupter Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of browsermob-proxy Show documentation
Show all versions of browsermob-proxy Show documentation
A programmatic HTTP/S designed for performance and functional testing
package net.lightbody.bmp.proxy.http;
import net.lightbody.bmp.proxy.util.Log;
import java.util.Set;
import java.util.concurrent.CopyOnWriteArraySet;
public class HttpClientInterrupter {
private static final Log LOG = new Log();
private static Set clients = new CopyOnWriteArraySet();
static {
Thread thread = new Thread(new Runnable() {
@Override
public void run() {
while (true) {
for (BrowserMobHttpClient client : clients) {
try {
client.checkTimeout();
} catch (Exception e) {
LOG.severe("Unexpected problem while checking timeout on a client", e);
}
}
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
// this is OK
}
}
}
}, "HttpClientInterrupter Thread");
thread.setDaemon(true);
thread.start();
}
public static void watch(BrowserMobHttpClient client) {
clients.add(client);
}
public static void release(BrowserMobHttpClient client) {
clients.remove(client);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy