refWorker = new RefQueueWorker(refQueue, this); Thread t = new Thread(refWorker); //@@@ use a thread factory t.setDaemon(true);
/** * 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(); } }
/** * The main loop of this worker. * If initialization succeeds, this method will only return * after {@link #shutdown shutdown()}. Only one thread can * execute the main loop at any time. */ public void run() { if (this.workerThread == null) { this.workerThread = Thread.currentThread(); } while (this.workerThread == Thread.currentThread()) { try { // remove the next reference and process it Reference<?> ref = refQueue.remove(); refHandler.handleReference(ref); } catch (InterruptedException e) { //@@@ is logging really necessary? this here is the //@@@ only reason for having a log in this class if (log.isDebugEnabled()) { log.debug(this.toString() + " interrupted", e); } } } }
/** * The main loop of this worker. * If initialization succeeds, this method will only return * after {@link #shutdown shutdown()}. Only one thread can * execute the main loop at any time. */ public void run() { if (this.workerThread == null) { this.workerThread = Thread.currentThread(); } while (this.workerThread == Thread.currentThread()) { try { // remove the next reference and process it Reference<?> ref = refQueue.remove(); refHandler.handleReference(ref); } catch (InterruptedException e) { //@@@ is logging really necessary? this here is the //@@@ only reason for having a log in this class if (log.isDebugEnabled()) { log.debug(this.toString() + " interrupted", e); } } } }
/** * 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(); } }
refWorker = new RefQueueWorker(refQueue, this); Thread t = new Thread(refWorker); //@@@ use a thread factory t.setDaemon(true);
/** * The main loop of this worker. * If initialization succeeds, this method will only return * after {@link #shutdown shutdown()}. Only one thread can * execute the main loop at any time. */ public void run() { if (this.workerThread == null) { this.workerThread = Thread.currentThread(); } while (this.workerThread == Thread.currentThread()) { try { // remove the next reference and process it Reference<?> ref = refQueue.remove(); refHandler.handleReference(ref); } catch (InterruptedException e) { //@@@ is logging really necessary? this here is the //@@@ only reason for having a log in this class if (log.isDebugEnabled()) { log.debug(this.toString() + " interrupted", e); } } } }
/** * 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(); } }
refWorker = new RefQueueWorker(refQueue, this); Thread t = new Thread(refWorker); //@@@ use a thread factory t.setDaemon(true);
/** * The main loop of this worker. * If initialization succeeds, this method will only return * after {@link #shutdown shutdown()}. Only one thread can * execute the main loop at any time. */ public void run() { if (this.workerThread == null) { this.workerThread = Thread.currentThread(); } while (this.workerThread == Thread.currentThread()) { try { // remove the next reference and process it Reference<?> ref = refQueue.remove(); refHandler.handleReference(ref); } catch (InterruptedException e) { //@@@ is logging really necessary? this here is the //@@@ only reason for having a log in this class if (log.isDebugEnabled()) { log.debug(this.toString() + " interrupted", e); } } } }
/** * 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(); } }
refWorker = new RefQueueWorker(refQueue, this); Thread t = new Thread(refWorker); //@@@ use a thread factory t.setDaemon(true);
/** * The main loop of this worker. * If initialization succeeds, this method will only return * after {@link #shutdown shutdown()}. Only one thread can * execute the main loop at any time. */ public void run() { if (this.workerThread == null) { this.workerThread = Thread.currentThread(); } while (this.workerThread == Thread.currentThread()) { try { // remove the next reference and process it Reference<?> ref = refQueue.remove(); refHandler.handleReference(ref); } catch (InterruptedException e) { //@@@ is logging really necessary? this here is the //@@@ only reason for having a log in this class if (log.isDebugEnabled()) { log.debug(this.toString() + " interrupted", e); } } } }
/** * 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(); } }
refWorker = new RefQueueWorker(refQueue, this); Thread t = new Thread(refWorker); //@@@ use a thread factory t.setDaemon(true);