|
|
|
@ -520,7 +520,12 @@ public final class serverCore extends serverAbstractThread implements serverThre
|
|
|
|
|
* @see org.apache.commons.pool.impl.GenericObjectPool#returnObject(java.lang.Object)
|
|
|
|
|
*/
|
|
|
|
|
public void returnObject(Object obj) throws Exception {
|
|
|
|
|
if (obj instanceof Session) {
|
|
|
|
|
super.returnObject(obj);
|
|
|
|
|
} else {
|
|
|
|
|
serverLog.logSevere("SESSION-POOL","Object of wront type '" + obj.getClass().getName() +
|
|
|
|
|
"'returned to pool.");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public synchronized void close() throws Exception {
|
|
|
|
@ -541,9 +546,11 @@ public final class serverCore extends serverAbstractThread implements serverThre
|
|
|
|
|
for ( int currentThreadIdx = 0; currentThreadIdx < threadCount; currentThreadIdx++ ) {
|
|
|
|
|
Thread currentThread = threadList[currentThreadIdx];
|
|
|
|
|
if (currentThread.isAlive()) {
|
|
|
|
|
if (currentThread instanceof Session) {
|
|
|
|
|
((Session)currentThread).setStopped(true);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// waiting a frew ms for the session objects to continue processing
|
|
|
|
|
try { Thread.sleep(500); } catch (InterruptedException ex) {}
|
|
|
|
@ -557,20 +564,24 @@ public final class serverCore extends serverAbstractThread implements serverThre
|
|
|
|
|
for ( int currentThreadIdx = 0; currentThreadIdx < threadCount; currentThreadIdx++ ) {
|
|
|
|
|
Thread currentThread = threadList[currentThreadIdx];
|
|
|
|
|
if (currentThread.isAlive()) {
|
|
|
|
|
if (currentThread instanceof Session) {
|
|
|
|
|
serverCore.this.log.logInfo("Trying to shutdown session thread '" + currentThread.getName() + "' [" + currentThreadIdx + "].");
|
|
|
|
|
((Session)currentThread).close();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// we need to use a timeout here because of missing interruptable session threads ...
|
|
|
|
|
serverCore.this.log.logFine("Waiting for " + serverCore.this.theSessionThreadGroup.activeCount() + " remaining session threads to finish shutdown ...");
|
|
|
|
|
for ( int currentThreadIdx = 0; currentThreadIdx < threadCount; currentThreadIdx++ ) {
|
|
|
|
|
Thread currentThread = threadList[currentThreadIdx];
|
|
|
|
|
if (currentThread.isAlive()) {
|
|
|
|
|
if (currentThread instanceof Session) {
|
|
|
|
|
serverCore.this.log.logFine("Waiting for session thread '" + currentThread.getName() + "' [" + currentThreadIdx + "] to finish shutdown.");
|
|
|
|
|
try { currentThread.join(500); } catch (InterruptedException ex) {}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
serverCore.this.log.logInfo("Shutdown of remaining session threads finish.");
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
@ -616,8 +627,7 @@ public final class serverCore extends serverAbstractThread implements serverThre
|
|
|
|
|
* @see org.apache.commons.pool.PoolableObjectFactory#validateObject(java.lang.Object)
|
|
|
|
|
*/
|
|
|
|
|
public boolean validateObject(Object obj) {
|
|
|
|
|
if (obj instanceof Session)
|
|
|
|
|
{
|
|
|
|
|
if (obj instanceof Session) {
|
|
|
|
|
Session theSession = (Session) obj;
|
|
|
|
|
if (!theSession.isAlive() || theSession.isInterrupted()) return false;
|
|
|
|
|
if (theSession.isRunning()) return true;
|
|
|
|
|