[concurrency-interest] concurrency errors in java.lang.Throwable

David Holmes dcholmes at optusnet.com.au
Wed Aug 2 22:04:50 EDT 2006


Joe,

> It would be desirable to:
>
> 1. Declare detailMessage final
> 2. Make getCause synchronized
> 3. Most of all: document intent so we don't need to have these discussions

getCause being synchronized would only be sufficient if the constructor used
the synchronized initCause() - otherwise we'd need a volatile, or atomics or
...

But to repeat what I've said elsewhere I don't expect Throwables to be
passed across threads very often. And if they are passed across threads then
that mechanism will need to involve synchronization. Hence access to the
cause would be safe.

I think this is a non-issue, but might support "fixing" it purely for reason
3. Only trouble is today it is Throwable tomorrow  its ...

Cheers,
David Holmes



More information about the Concurrency-interest mailing list