[SNMP4J] What about uncaught RuntimeExceptions?

Frank Fock fock at agentpp.com
Tue Mar 28 00:22:20 CEST 2006


Hi Fabian,

The ThreadPool should be implemented so that it does not
throw any Runtime or other "unexpected" exception.
If you want to avoid any such exceptions you should
use a try-catch in the Runnable.run() method you put
into the thread pool.

I do not like catching exceptions at places where
I do not have an idea to handle them. One of these
famous

"try { ... } catch (Exception e) { return null;}"

Nevertheless, I am open to add your suggestion
(for example by rethrowing the exception). Have you
observed such a runtime exception that was caused
by SNMP4J?

Thanks,
Frank


Fabian Nart wrote:
> Hi,
> 
> wouldn't it be nice to wrap the ThreadPool.TaskManager's run-method-body 
> with a piece of code like the following?
> 
> try {
>   // here comes the method body as it is until now
> } catch(RuntimeException re) {
>   // do some logging
> }
> 
> I think this way we can be sure that there is no RuntimeException that 
> we never be aware of (Who knows where the UncaughtException() method of 
> the ThreadGroup writes its output to...)
> 
> cheers, Fabian
> _______________________________________________
> 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