"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "httpclient/src/main/java/org/apache/http/impl/conn/BasicHttpClientConnectionManager.java" between
httpcomponents-client-4.5.6-src.tar.gz and httpcomponents-client-4.5.7-src.tar.gz

About: HttpComponents is an Apache project responsible for creating and maintaining a toolset of low level Java components focused on HTTP and associated protocols. Java sources.

BasicHttpClientConnectionManager.java  (httpcomponents-client-4.5.6-src):BasicHttpClientConnectionManager.java  (httpcomponents-client-4.5.7-src)
skipping to change at line 203 skipping to change at line 203
Args.notNull(route, "Route"); Args.notNull(route, "Route");
return new ConnectionRequest() { return new ConnectionRequest() {
@Override @Override
public boolean cancel() { public boolean cancel() {
// Nothing to abort, since requests are immediate. // Nothing to abort, since requests are immediate.
return false; return false;
} }
@Override @Override
public HttpClientConnection get(final long timeout, final TimeUnit t unit) { public HttpClientConnection get(final long timeout, final TimeUnit t imeUnit) {
return BasicHttpClientConnectionManager.this.getConnection( return BasicHttpClientConnectionManager.this.getConnection(
route, state); route, state);
} }
}; };
} }
private synchronized void closeConnection() { private synchronized void closeConnection() {
if (this.conn != null) { if (this.conn != null) {
this.log.debug("Closing connection"); this.log.debug("Closing connection");
skipping to change at line 258 skipping to change at line 258
} }
this.conn.setSocketTimeout(this.socketConfig.getSoTimeout()); this.conn.setSocketTimeout(this.socketConfig.getSoTimeout());
this.leased = true; this.leased = true;
return this.conn; return this.conn;
} }
@Override @Override
public synchronized void releaseConnection( public synchronized void releaseConnection(
final HttpClientConnection conn, final HttpClientConnection conn,
final Object state, final Object state,
final long keepalive, final TimeUnit tunit) { final long keepalive, final TimeUnit timeUnit) {
Args.notNull(conn, "Connection"); Args.notNull(conn, "Connection");
Asserts.check(conn == this.conn, "Connection not obtained from this mana ger"); Asserts.check(conn == this.conn, "Connection not obtained from this mana ger");
if (this.log.isDebugEnabled()) { if (this.log.isDebugEnabled()) {
this.log.debug("Releasing connection " + conn); this.log.debug("Releasing connection " + conn);
} }
if (this.isShutdown.get()) { if (this.isShutdown.get()) {
return; return;
} }
try { try {
this.updated = System.currentTimeMillis(); this.updated = System.currentTimeMillis();
skipping to change at line 280 skipping to change at line 280
this.conn = null; this.conn = null;
this.route = null; this.route = null;
this.conn = null; this.conn = null;
this.expiry = Long.MAX_VALUE; this.expiry = Long.MAX_VALUE;
} else { } else {
this.state = state; this.state = state;
this.conn.setSocketTimeout(0); this.conn.setSocketTimeout(0);
if (this.log.isDebugEnabled()) { if (this.log.isDebugEnabled()) {
final String s; final String s;
if (keepalive > 0) { if (keepalive > 0) {
s = "for " + keepalive + " " + tunit; s = "for " + keepalive + " " + timeUnit;
} else { } else {
s = "indefinitely"; s = "indefinitely";
} }
this.log.debug("Connection can be kept alive " + s); this.log.debug("Connection can be kept alive " + s);
} }
if (keepalive > 0) { if (keepalive > 0) {
this.expiry = this.updated + tunit.toMillis(keepalive); this.expiry = this.updated + timeUnit.toMillis(keepalive);
} else { } else {
this.expiry = Long.MAX_VALUE; this.expiry = Long.MAX_VALUE;
} }
} }
} finally { } finally {
this.leased = false; this.leased = false;
} }
} }
@Override @Override
skipping to change at line 346 skipping to change at line 346
public synchronized void closeExpiredConnections() { public synchronized void closeExpiredConnections() {
if (this.isShutdown.get()) { if (this.isShutdown.get()) {
return; return;
} }
if (!this.leased) { if (!this.leased) {
checkExpiry(); checkExpiry();
} }
} }
@Override @Override
public synchronized void closeIdleConnections(final long idletime, final Tim public synchronized void closeIdleConnections(final long idletime, final Tim
eUnit tunit) { eUnit timeUnit) {
Args.notNull(tunit, "Time unit"); Args.notNull(timeUnit, "Time unit");
if (this.isShutdown.get()) { if (this.isShutdown.get()) {
return; return;
} }
if (!this.leased) { if (!this.leased) {
long time = tunit.toMillis(idletime); long time = timeUnit.toMillis(idletime);
if (time < 0) { if (time < 0) {
time = 0; time = 0;
} }
final long deadline = System.currentTimeMillis() - time; final long deadline = System.currentTimeMillis() - time;
if (this.updated <= deadline) { if (this.updated <= deadline) {
closeConnection(); closeConnection();
} }
} }
} }
 End of changes. 6 change blocks. 
8 lines changed or deleted 8 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)