commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sandy McArthur (JIRA)" <>
Subject [jira] Commented: (POOL-142) Swallowing exceptions throw by factory destroy() methods can hide genuine issues
Date Fri, 05 Jun 2009 19:05:07 GMT


Sandy McArthur commented on POOL-142:

It's not specified when a poolable object is destroyed. It's is valid and likely for pools
with evictors for a poolable object to be destroyed by a different thread than one from client
code returning a poolable object and/or at an unknown later point in time. Also, when returning
or invalidating a poolable object the client code is very unlikely to want to deal with an
exception as the client code is done with that object and likely done processing any related
work. (This is is similar to how OutputStream.close() throwing an IOException is a meaningless
annoyance.) For these reasons exceptions during a destroy phase are swallowed lest they cause
more unanticipated problems then they solve.

Programmers worried about an exception during the destroy phase can insert a try/catch just
their entire destroy method's contents. 
eg: void destroyObject(Object obj) { try { destroy(obj) } catch (Exception e) { log(e) } }

> Swallowing exceptions throw by factory destroy() methods can hide genuine issues
> --------------------------------------------------------------------------------
>                 Key: POOL-142
>                 URL:
>             Project: Commons Pool
>          Issue Type: Bug
>    Affects Versions: 1.5
>            Reporter: Mark Thomas
>             Fix For: 2.0
> Swallowing all factory exceptions prevents the factory indicating to the pool that there
is an issue. For example, attempting to destroy an object twice may indicate a bug in the
pool code. The factory exception policy needs to be reviewed. If changed this will be an API
change to needs to wait until 2.0

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

View raw message