On 17/03/2010, Mark Thomas <ma...@apache.org> wrote:
> One of the POOL test cases is failing -
> TestSoftRefOutOfMemory.testOutOfMemoryError()
>
>  I can't see any recent code changes that may have caused this and I think
> the recent removal of the testAll code is what has exposed this. On the
> basis that always catching Throwable is bad, but there are many cases POOL
> does need to catch, what do folks here think to the liberal application of
> the following anywhere POOL catches Throwable?

ThreadDeath should never be ignored either.

Is it necessary to swallow all Throwables apart from VME?

Maybe should rethrow some other classes of Throwable as well.

Is it known which Throwables Pool does need to catch?

>  Index:
> src/java/org/apache/commons/pool/impl/SoftReferenceObjectPool.java
> ===================================================================
>  ---
> src/java/org/apache/commons/pool/impl/SoftReferenceObjectPool.java
> (revision 924253)
>  +++
> src/java/org/apache/commons/pool/impl/SoftReferenceObjectPool.java
> (working copy)
>  @@ -106,10 +106,18 @@
>                          throw new Exception("ValidateObject failed");
>                      }
>                  } catch (Throwable t) {
>  +                    if (t instanceof VirtualMachineError) {
>  +                        // Always throw VM errors immediately
>  +                        throw (VirtualMachineError) t;
>  +                    }
>                      try {
>                          _factory.destroyObject(obj);
>                      } catch (Throwable t2) {
>  -                        // swallowed
>  +                        if (t2 instanceof VirtualMachineError) {
>  +                            // Always throw VM errors immediately
>  +                            throw (VirtualMachineError) t2;
>  +                        }
>  +                        // Otherwise swallowed
>                      } finally {
>                          obj = null;
>                      }
>
>  This fixes the current test failures but really should be applied to all
> places where Throwable is caught.
>
>  Mark
>
>
>
> ---------------------------------------------------------------------
>  To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
>  For additional commands, e-mail: dev-h...@commons.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org

Reply via email to