tomee-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject Re: Problems shutting down embedded instance
Date Thu, 02 Apr 2009 13:52:40 GMT
Yes, a parameter check would do it, I think.

    public Memoizer(Computable<K, V> c) {
        if (c == null)
            throw new IllegalArgumentException("Computable is null");
        this.c = c;

I have also considered rethrowing any unchecked exceptions wrapped in the ExecutionException:
            } catch (ExecutionException e) {
                Throwable theCause = e.getCause();
                /* Rethrow any unchecked exceptions thrown by the Computable. */
                if ((theCause != null) && ((theCause instanceof Error) ||
                    (theCause instanceof RuntimeException)))
                    throw theCause;

I assume that ExecutionException may wrap unchecked exceptions thrown when c != null, in which
case I feel such exceptions should be allowed to propagate out of the Memoizer. Let me know
what you think.
Best regards,
 Ivan A Krizsan

View raw message