[SNMP4J] Table Listeners and multi-threading

Frank Fock fock at agentpp.com
Sun Nov 14 15:36:58 CET 2004


Hi,

A straight-forward approach would be using multiple TableUtils
instances. So you can separate the callbacks easily. However
in any case the callback will be executed in the context of the
port listener thread of the used TransportMapping or if you
use the MultithreadedMessageDispatcher it will be the context
of one of the threads in the MultithreadedMessageDispatcher's
thread pool.

A "centralized" callback handler can be realized by a singleton class
that implements the TableListener interface, however the callback
will still be executed in the thread context of the event firing thread.

To map an event to your thread, you will have to implement a queue.

Hope this helps.

Best regards,
Frank

pasteman8-agentpp at yahoo.com wrote:

>Hi,
>
>My question is this:
>If I use table utils in a multithreaded application in
>a way that each thread is set to retrieve a table by
>using table utils, I assume that each thread will also
>be a listener and will get its own callback called
>when a row is read from the table.
>My question is:
>1. Is there a way to make a 'centralized' callback? I
>assume that there is, technically, by using a static
>method and passing the correct user object to it or
>some other way maybe (If anyone has a good idea, I
>would be happy to hear it). The question is if this
>thing can work properly.
>2. If the callback is per-thread, is it more or less
>efficient that using a standard 'walk' for the table
>instead of using a listener. What about a 'central'
>callback in terms of efficiency?
>
>Thanks,
>G
>
>_______________________________________________
>SNMP4J mailing list
>SNMP4J at agentpp.org
>http://p15141779.pureserver.info/mailman/listinfo/snmp4j
>
>  
>





More information about the SNMP4J mailing list