Le 18/04/2017 à 23:06, Gary Gregory a écrit :

> This use case does not make sense to me. If an object is immutable, then it
> is thread safe. If you want to include an asynchronous external resource as
> part of your object, then the object might not be in fact, immutable.
> Speaking of a specific use case would be better.

What about something like a FileOutputStream? The object fields could be
final (the file descriptor never changes), but the write methods can't
be safely called concurrently.

Another example would be an interface to a remote service. The stub
could be immutable and contain the URL of the remote service, but the
operations couldn't be called by multiple threads.

Emmanuel Bourg


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

Reply via email to