commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tim Bessie <tbes...@meez.com>
Subject [configuration] How to get threadsafe subset() config in a threadsafe way?
Date Tue, 13 Mar 2012 06:34:14 GMT
Hi all...

So we're keeping some config information CompositeConfiguration object, and
we need to get subsets of this configuration data.

When I call .subset(...), and then do some checks on the subset (isEmpty(),
etc.), I sometimes get ConcurrentModificationExceptions.  I'm not sure
what's modifying the underlying configuration, although we do have
occasional setting of configuration values throughout the running of our
app.

What would be *ideal* would be to:

1. NOT have to synchronize every access to the configuration object, since
we have a high-volume application
2. To allow read and write operations to happen to the configuration object
without worrying about ConcurrentModificationExceptions
3. To be able to call .subset(...) on the configuration object and 1) not
risk a ConcurrentModificationException during this operation, and 2) get a
COPY of the subset back, so that further operations on the subset don't
risk ConcurrentModificationExceptions

Does anyone know of a way to do this?  Or is the ONLY way to guarantee lack
of CMEs to synchronize EVERY access (reads, writes, subsets, iterations,
etc.)?

If this is the case, how have others dealt with situations like ours, where
you do mostly just reads on a Configuration object, but very occasional
writes, and need to take subsets, and need to avoid exceptions while doing
this?  With a high volume app, synchronizing every access would slow things
waaaaaay down, thus my question.

- Tim

-- 

Tim Bessie
Meez, Inc.
tbessie@meez.com

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message