/** * Creates a new pool entry. * * @param op the connection operator * @param route the planned route for the connection * @param queue the reference queue for tracking GC of this entry, * or <code>null</code> */ public BasicPoolEntry(ClientConnectionOperator op, HttpRoute route, ReferenceQueue<Object> queue) { super(op, route); if (route == null) { throw new IllegalArgumentException("HTTP route may not be null"); } this.reference = new BasicPoolEntryRef(this, queue); }
/** * Shuts down this pool and all associated resources. * Overriding methods MUST call the implementation here! */ public void shutdown() { poolLock.lock(); try { if (isShutDown) return; // no point in monitoring GC anymore if (refWorker != null) refWorker.shutdown(); // close all connections that are issued to an application Iterator<BasicPoolEntryRef> iter = issuedConnections.iterator(); while (iter.hasNext()) { BasicPoolEntryRef per = iter.next(); iter.remove(); BasicPoolEntry entry = per.get(); if (entry != null) { closeConnection(entry.getConnection()); } } // remove all references to connections //@@@ use this for shutting them down instead? idleConnHandler.removeAll(); isShutDown = true; } finally { poolLock.unlock(); } }
public void handleReference(Reference ref) { // END android-changed poolLock.lock(); try { if (ref instanceof BasicPoolEntryRef) { // check if the GCed pool entry was still in use //@@@ find a way to detect this without lookup //@@@ flag in the BasicPoolEntryRef, to be reset when freed? final boolean lost = issuedConnections.remove(ref); if (lost) { final HttpRoute route = ((BasicPoolEntryRef)ref).getRoute(); if (log.isDebugEnabled()) { log.debug("Connection garbage collected. " + route); } handleLostEntry(route); } } } finally { poolLock.unlock(); } }
/** * Creates a new pool entry. * * @param op the connection operator * @param route the planned route for the connection * @param queue the reference queue for tracking GC of this entry, * or <code>null</code> */ public BasicPoolEntry(ClientConnectionOperator op, HttpRoute route, ReferenceQueue<Object> queue) { super(op, route); if (route == null) { throw new IllegalArgumentException("HTTP route may not be null"); } this.reference = new BasicPoolEntryRef(this, queue); }
public void handleReference(Reference ref) { // END android-changed poolLock.lock(); try { if (ref instanceof BasicPoolEntryRef) { // check if the GCed pool entry was still in use //@@@ find a way to detect this without lookup //@@@ flag in the BasicPoolEntryRef, to be reset when freed? final boolean lost = issuedConnections.remove(ref); if (lost) { final HttpRoute route = ((BasicPoolEntryRef)ref).getRoute(); if (log.isDebugEnabled()) { log.debug("Connection garbage collected. " + route); } handleLostEntry(route); } } } finally { poolLock.unlock(); } }
/** * Shuts down this pool and all associated resources. * Overriding methods MUST call the implementation here! */ public void shutdown() { poolLock.lock(); try { if (isShutDown) return; // no point in monitoring GC anymore if (refWorker != null) refWorker.shutdown(); // close all connections that are issued to an application Iterator<BasicPoolEntryRef> iter = issuedConnections.iterator(); while (iter.hasNext()) { BasicPoolEntryRef per = iter.next(); iter.remove(); BasicPoolEntry entry = per.get(); if (entry != null) { closeConnection(entry.getConnection()); } } // remove all references to connections //@@@ use this for shutting them down instead? idleConnHandler.removeAll(); isShutDown = true; } finally { poolLock.unlock(); } }
/** * Creates a new pool entry. * * @param op the connection operator * @param route the planned route for the connection * @param queue the reference queue for tracking GC of this entry, * or <code>null</code> */ public BasicPoolEntry(ClientConnectionOperator op, HttpRoute route, ReferenceQueue<Object> queue) { super(op, route); if (route == null) { throw new IllegalArgumentException("HTTP route may not be null"); } this.reference = new BasicPoolEntryRef(this, queue); }
public void handleReference(Reference ref) { // END android-changed poolLock.lock(); try { if (ref instanceof BasicPoolEntryRef) { // check if the GCed pool entry was still in use //@@@ find a way to detect this without lookup //@@@ flag in the BasicPoolEntryRef, to be reset when freed? final boolean lost = issuedConnections.remove(ref); if (lost) { final HttpRoute route = ((BasicPoolEntryRef)ref).getRoute(); if (log.isDebugEnabled()) { log.debug("Connection garbage collected. " + route); } handleLostEntry(route); } } } finally { poolLock.unlock(); } }
/** * Shuts down this pool and all associated resources. * Overriding methods MUST call the implementation here! */ public void shutdown() { poolLock.lock(); try { if (isShutDown) return; // no point in monitoring GC anymore if (refWorker != null) refWorker.shutdown(); // close all connections that are issued to an application Iterator<BasicPoolEntryRef> iter = issuedConnections.iterator(); while (iter.hasNext()) { BasicPoolEntryRef per = iter.next(); iter.remove(); BasicPoolEntry entry = per.get(); if (entry != null) { closeConnection(entry.getConnection()); } } // remove all references to connections //@@@ use this for shutting them down instead? idleConnHandler.removeAll(); isShutDown = true; } finally { poolLock.unlock(); } }
/** * Creates a new pool entry. * * @param op the connection operator * @param route the planned route for the connection * @param queue the reference queue for tracking GC of this entry, * or <code>null</code> */ public BasicPoolEntry(ClientConnectionOperator op, HttpRoute route, ReferenceQueue<Object> queue) { super(op, route); if (route == null) { throw new IllegalArgumentException("HTTP route may not be null"); } this.reference = new BasicPoolEntryRef(this, queue); }
public void handleReference(Reference ref) { // END android-changed poolLock.lock(); try { if (ref instanceof BasicPoolEntryRef) { // check if the GCed pool entry was still in use //@@@ find a way to detect this without lookup //@@@ flag in the BasicPoolEntryRef, to be reset when freed? final boolean lost = issuedConnections.remove(ref); if (lost) { final HttpRoute route = ((BasicPoolEntryRef)ref).getRoute(); if (log.isDebugEnabled()) { log.debug("Connection garbage collected. " + route); } handleLostEntry(route); } } } finally { poolLock.unlock(); } }
/** * Shuts down this pool and all associated resources. * Overriding methods MUST call the implementation here! */ public void shutdown() { poolLock.lock(); try { if (isShutDown) return; // no point in monitoring GC anymore if (refWorker != null) refWorker.shutdown(); // close all connections that are issued to an application Iterator<BasicPoolEntryRef> iter = issuedConnections.iterator(); while (iter.hasNext()) { BasicPoolEntryRef per = iter.next(); iter.remove(); BasicPoolEntry entry = per.get(); if (entry != null) { closeConnection(entry.getConnection()); } } // remove all references to connections //@@@ use this for shutting them down instead? idleConnHandler.removeAll(); isShutDown = true; } finally { poolLock.unlock(); } }
/** * Creates a new pool entry. * * @param op the connection operator * @param route the planned route for the connection * @param queue the reference queue for tracking GC of this entry, * or <code>null</code> */ public BasicPoolEntry(ClientConnectionOperator op, HttpRoute route, ReferenceQueue<Object> queue) { super(op, route); if (route == null) { throw new IllegalArgumentException("HTTP route may not be null"); } this.reference = new BasicPoolEntryRef(this, queue); }
public void handleReference(Reference ref) { // END android-changed poolLock.lock(); try { if (ref instanceof BasicPoolEntryRef) { // check if the GCed pool entry was still in use //@@@ find a way to detect this without lookup //@@@ flag in the BasicPoolEntryRef, to be reset when freed? final boolean lost = issuedConnections.remove(ref); if (lost) { final HttpRoute route = ((BasicPoolEntryRef)ref).getRoute(); if (log.isDebugEnabled()) { log.debug("Connection garbage collected. " + route); } handleLostEntry(route); } } } finally { poolLock.unlock(); } }
/** * Shuts down this pool and all associated resources. * Overriding methods MUST call the implementation here! */ public void shutdown() { poolLock.lock(); try { if (isShutDown) return; // no point in monitoring GC anymore if (refWorker != null) refWorker.shutdown(); // close all connections that are issued to an application Iterator<BasicPoolEntryRef> iter = issuedConnections.iterator(); while (iter.hasNext()) { BasicPoolEntryRef per = iter.next(); iter.remove(); BasicPoolEntry entry = per.get(); if (entry != null) { closeConnection(entry.getConnection()); } } // remove all references to connections //@@@ use this for shutting them down instead? idleConnHandler.removeAll(); isShutDown = true; } finally { poolLock.unlock(); } }