commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Emmanuel Bourg <>
Subject Re: [lang] new concurrency annotations
Date Tue, 18 Apr 2017 21:14:52 GMT
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:
For additional commands, e-mail:

View raw message