On 29 October 2010 18:51, James Carman <[email protected]> wrote: > On Fri, Oct 29, 2010 at 12:48 PM, sebb <[email protected]> wrote: >> >> Yes, but the code will still need to use the read lock whenever it >> reads the field to ensure changes are propagated correctly. >> Both the writer and reader threads need to synch. on the same lock in >> order for changes to be published safely. >> >> Not sure using a read/write lock would gain anything over using >> volatile - which has the advantage that one cannot bypass it. >> > > I'm not so concerned with access to the variable itself really. I'm > more concerned with a client trying to borrow/return an object while > the pool is in the middle of reconfiguring itself.
I had overlooked that aspect ... If some changes are more expensive to perform, then the method might want to determine which items have changed, rather than just reconfiguring everything. There may be some changes that don't require a pool update. Factory reconfig probably just needs to update the stored config variable, which can be volatile. > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
