use of org.apache.http.conn.OperatedClientConnection in project platform_external_apache-http by android.
the class RouteSpecificPool method allocEntry.
/**
* Obtains a free entry from this pool, if one is available.
*
* @return an available pool entry, or <code>null</code> if there is none
*/
public BasicPoolEntry allocEntry(final Object state) {
if (!freeEntries.isEmpty()) {
ListIterator<BasicPoolEntry> it = freeEntries.listIterator(freeEntries.size());
while (it.hasPrevious()) {
BasicPoolEntry entry = it.previous();
if (LangUtils.equals(state, entry.getState())) {
it.remove();
return entry;
}
}
}
if (!freeEntries.isEmpty()) {
BasicPoolEntry entry = freeEntries.remove();
entry.setState(null);
OperatedClientConnection conn = entry.getConnection();
try {
conn.close();
} catch (IOException ex) {
log.debug("I/O error closing connection", ex);
}
return entry;
}
return null;
}
Aggregations