SingleClientConnManager.java (httpcomponents-client-4.5.6-src) | : | SingleClientConnManager.java (httpcomponents-client-4.5.7-src) | ||
---|---|---|---|---|
skipping to change at line 189 | skipping to change at line 189 | |||
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 SingleClientConnManager.this.getConnection( | return SingleClientConnManager.this.getConnection( | |||
route, state); | route, state); | |||
} | } | |||
}; | }; | |||
} | } | |||
/** | /** | |||
* Obtains a connection. | * Obtains a connection. | |||
* | * | |||
skipping to change at line 320 | skipping to change at line 320 | |||
@Override | @Override | |||
public void closeExpiredConnections() { | public void closeExpiredConnections() { | |||
final long time = connectionExpiresTime; | final long time = connectionExpiresTime; | |||
if (System.currentTimeMillis() >= time) { | if (System.currentTimeMillis() >= time) { | |||
closeIdleConnections(0, TimeUnit.MILLISECONDS); | closeIdleConnections(0, TimeUnit.MILLISECONDS); | |||
} | } | |||
} | } | |||
@Override | @Override | |||
public void closeIdleConnections(final long idletime, final TimeUnit tunit) { | public void closeIdleConnections(final long idletime, final TimeUnit timeUni t) { | |||
assertStillUp(); | assertStillUp(); | |||
// idletime can be 0 or negative, no problem there | // idletime can be 0 or negative, no problem there | |||
Args.notNull(tunit, "Time unit"); | Args.notNull(timeUnit, "Time unit"); | |||
synchronized (this) { | synchronized (this) { | |||
if ((managedConn == null) && uniquePoolEntry.connection.isOpen()) { | if ((managedConn == null) && uniquePoolEntry.connection.isOpen()) { | |||
final long cutoff = | final long cutoff = | |||
System.currentTimeMillis() - tunit.toMillis(idletime); | System.currentTimeMillis() - timeUnit.toMillis(idletime); | |||
if (lastReleaseTime <= cutoff) { | if (lastReleaseTime <= cutoff) { | |||
try { | try { | |||
uniquePoolEntry.close(); | uniquePoolEntry.close(); | |||
} catch (final IOException iox) { | } catch (final IOException iox) { | |||
// ignore | // ignore | |||
log.debug("Problem closing idle connection.", iox); | log.debug("Problem closing idle connection.", iox); | |||
} | } | |||
} | } | |||
} | } | |||
} | } | |||
End of changes. 4 change blocks. | ||||
4 lines changed or deleted | 4 lines changed or added |