commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From James Carman <ja...@carmanconsulting.com>
Subject Re: [pool] Pool config vs. factory hierarchies.
Date Fri, 29 Oct 2010 16:06:43 GMT
On Fri, Oct 29, 2010 at 11:40 AM, sebb <sebbaz@gmail.com> wrote:
>
> If Config instances are immutable, then there is no need to synch.
> access to their contents.
> However, if the field which stores the Config instance is not final,
> then all accesses to that need to be synch. - or the field could be
> volatile.
>
> Once the code has obtained the config pointer safely, it can access
> the final Config fields without synch. This would eliminate the need
> for the locks, provided that the config instance was fetched at most
> once per operation.
>

If the only place where that field can change is in the reconfigure()
method, then you can use the read/write lock to handle your
synchronization.

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


Mime
View raw message