java http client eviction
public static class IdleConnectionMonitorThread extends Thread {
private final HttpClientConnectionManager connMgr;
private volatile boolean shutdown;
public IdleConnectionMonitorThread(HttpClientConnectionManager connMgr) {
super();
this.connMgr = connMgr;
}
@Override
public void run() {
try {
while (!shutdown) {
synchronized (this) {
wait(5000);
// Close expired connections
connMgr.closeExpiredConnections();
// Optionally, close connections
// that have been idle longer than 30 sec
connMgr.closeIdleConnections(30, TimeUnit.SECONDS);
}
}
} catch (InterruptedException ex) {
// terminate
}
}
public void shutdown() {
shutdown = true;
synchronized (this) {
notifyAll();
}
}
}
Also in Java:
- java random between two strings
- hashset contains java
- how to delete an element from an array in java
- get current unix timestamp java
- java print type of object
- string isEmpty java
- java lerp
- java jaxb unmarshall xml to map
- change java version command line debian
- method resolve file in java
- how to use the this keyword in java
- java call another constructor
- diagonal difference hackerrank solution in java 8 using list
- sqrt in java
- covariant type in java
- for loop in java stack overflow
- graal.js pass javascript array to java function
- close searchview android java
- java substring
- how to separate no and text in java
- JFrame text java
- java int passed by reference
- java list get first element
- using get in map in java