"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "httpclient/src/main/java-deprecated/org/apache/http/impl/conn/BasicClientConnectionManager.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.

BasicClientConnectionManager.java  (httpcomponents-client-4.5.6-src):BasicClientConnectionManager.java  (httpcomponents-client-4.5.7-src)
skipping to change at line 144 skipping to change at line 144
return new ClientConnectionRequest() { return new ClientConnectionRequest() {
@Override @Override
public void abortRequest() { public void abortRequest() {
// Nothing to abort, since requests are immediate. // Nothing to abort, since requests are immediate.
} }
@Override @Override
public ManagedClientConnection getConnection( public ManagedClientConnection getConnection(
final long timeout, final TimeUnit tunit) { final long timeout, final TimeUnit timeUnit) {
return BasicClientConnectionManager.this.getConnection( return BasicClientConnectionManager.this.getConnection(
route, state); route, state);
} }
}; };
} }
private void assertNotShutdown() { private void assertNotShutdown() {
Asserts.check(!this.shutdown, "Connection manager has been shut down"); Asserts.check(!this.shutdown, "Connection manager has been shut down");
} }
skipping to change at line 194 skipping to change at line 194
try { try {
conn.shutdown(); conn.shutdown();
} catch (final IOException iox) { } catch (final IOException iox) {
if (this.log.isDebugEnabled()) { if (this.log.isDebugEnabled()) {
this.log.debug("I/O exception shutting down connection", iox); this.log.debug("I/O exception shutting down connection", iox);
} }
} }
} }
@Override @Override
public void releaseConnection(final ManagedClientConnection conn, final long keepalive, final TimeUnit tunit) { public void releaseConnection(final ManagedClientConnection conn, final long keepalive, final TimeUnit timeUnit) {
Args.check(conn instanceof ManagedClientConnectionImpl, "Connection clas s mismatch, " + Args.check(conn instanceof ManagedClientConnectionImpl, "Connection clas s mismatch, " +
"connection not obtained from this manager"); "connection not obtained from this manager");
final ManagedClientConnectionImpl managedConn = (ManagedClientConnection Impl) conn; final ManagedClientConnectionImpl managedConn = (ManagedClientConnection Impl) conn;
synchronized (managedConn) { synchronized (managedConn) {
if (this.log.isDebugEnabled()) { if (this.log.isDebugEnabled()) {
this.log.debug("Releasing connection " + conn); this.log.debug("Releasing connection " + conn);
} }
if (managedConn.getPoolEntry() == null) { if (managedConn.getPoolEntry() == null) {
return; // already released return; // already released
} }
skipping to change at line 217 skipping to change at line 217
synchronized (this) { synchronized (this) {
if (this.shutdown) { if (this.shutdown) {
shutdownConnection(managedConn); shutdownConnection(managedConn);
return; return;
} }
try { try {
if (managedConn.isOpen() && !managedConn.isMarkedReusable()) { if (managedConn.isOpen() && !managedConn.isMarkedReusable()) {
shutdownConnection(managedConn); shutdownConnection(managedConn);
} }
if (managedConn.isMarkedReusable()) { if (managedConn.isMarkedReusable()) {
this.poolEntry.updateExpiry(keepalive, tunit != null ? t unit : TimeUnit.MILLISECONDS); this.poolEntry.updateExpiry(keepalive, timeUnit != null ? timeUnit : TimeUnit.MILLISECONDS);
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);
} }
} }
} finally { } finally {
managedConn.detach(); managedConn.detach();
this.conn = null; this.conn = null;
if (this.poolEntry.isClosed()) { if (this.poolEntry.isClosed()) {
skipping to change at line 252 skipping to change at line 252
assertNotShutdown(); assertNotShutdown();
final long now = System.currentTimeMillis(); final long now = System.currentTimeMillis();
if (this.poolEntry != null && this.poolEntry.isExpired(now)) { if (this.poolEntry != null && this.poolEntry.isExpired(now)) {
this.poolEntry.close(); this.poolEntry.close();
this.poolEntry.getTracker().reset(); this.poolEntry.getTracker().reset();
} }
} }
} }
@Override @Override
public void closeIdleConnections(final long idletime, final TimeUnit tunit) public void closeIdleConnections(final long idletime, final TimeUnit timeUni
{ t) {
Args.notNull(tunit, "Time unit"); Args.notNull(timeUnit, "Time unit");
synchronized (this) { synchronized (this) {
assertNotShutdown(); assertNotShutdown();
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.poolEntry != null && this.poolEntry.getUpdated() <= deadlin e) { if (this.poolEntry != null && this.poolEntry.getUpdated() <= deadlin e) {
this.poolEntry.close(); this.poolEntry.close();
this.poolEntry.getTracker().reset(); this.poolEntry.getTracker().reset();
} }
} }
} }
 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)