[SNMP4J] Threadpool.stop locks
Frank Fock
fock at agentpp.com
Tue Feb 28 21:33:40 CET 2006
Hi Richard,
To fix this bug, change the run() method of TaskManager
in ThreadPool to (the first line makes the difference):
public synchronized void run() {
while ((!stop) && run) {
if (task != null) {
task.run();
synchronized (ThreadPool.this) {
task = null;
ThreadPool.this.notify();
}
}
else {
try {
wait();
}
catch (InterruptedException ex) {
run = respawnThreads;
break;
}
}
}
}
Best regards,
Frank
Richard Tarczaly wrote:
> First of I'd like to thank for the extraordinary job you made putting
> the SNMP4j together.
>
> I'm currently using the MultiThreadedMessageDispatcher with a Threadpool
> to loadbalance incoming request responses, and once I'm done I do the
> following steps :
>
> 1.) Check if udp_threadPool.isIdle()
> 2.) if yes call : udp_threadPool.stop()
>
> My problem (possibly missunderstanding) is that stop will lock at this
> point and will never finish, even if isIdle() returns true.
>
> Therefore I must call interrupt() before stop().
>
> Shouldn't a stop() gracefully finish and join the threads instead of
> locking up (even if isIdle returns me true) ?
>
>
> Thank you in advance,
> Richard
> _______________________________________________
> SNMP4J mailing list
> SNMP4J at agentpp.org
> http://lists.agentpp.org/mailman/listinfo/snmp4j
--
AGENT++
http://www.agentpp.com
http://www.mibexplorer.com
http://www.mibdesigner.com
More information about the SNMP4J
mailing list