[SNMP4J] Running MultiThreadedTrapReceiver via ThreadPoolExecutor.execute()

Shlomo Kashani shlomo at tikalk.com
Mon Aug 9 11:07:15 CEST 2010


Hi all,
I am trying to use the MultiThreadedTrapReceiver as follows:

public class MultiThreadedTrapReceiver extends Thread implements
CommandResponder{

Or

public class MultiThreadedTrapReceiver implements CommandResponder Runnable{

I then create and instance of MultiThreadedTrapReceiver and using a custom
ThreadPoolExecutor.execute() I run the class.

The issue is that it returns immediately after its run() method is invoked
and does not "wait" for traps to arrive and hence the program terminates at
once.

On the other hand if I just use it "as is" via main() the I can see its
waiting and receiving traps.

What could be the reason? do I need to use a CountDownLatch to wait in the
"calling" thread for the MultiThreadedTrapReceiver? it does not make sense.

Thanks,

Shlomo.



More information about the SNMP4J mailing list