multithreadingjakarta-eesnmp4j

Is it possible to implement an snmp trap receiver using SNMP4J in a Java EE environment?


I'm trying to implement an SNMP trap reciever that will be deployed as part of a service that runs on a Payara 5 server, but it appears to require the use of org.snmp4j.util.MultiThreadedMessageDispatcherand org.snmp4j.util.ThreadPool. I'm looking for a way to implement this without having to spawn my own threads. Any suggestions?


Solution

  • The keys to your problem are in the javax.enterprise.concurrent package. This provides mandated support for thread creation and management, even from EJBs. It is provided as part of the Java EE 7 and newer platforms, including Payara 5.

    You will need to provide your own implementation of org.snmp4j.util.WorkerPool which would be built on top of the javax.enterprise.concurrent package.

    If you enjoy programming for a living this would be the fun part.