On Thu, Apr 23, 2015 at 4:42 AM, Matthias J. Sax < [email protected]> wrote:
> In my case, I use a class hierarchy with abstract spouts/bolts and > multiple concrete spouts/bolts. The abstract class uses some default > values (if not provided in the given config) similar to the derived > classes. However, some derived classes overwrite the default values for > the abstract class, ie, if no value is given in the config, some derived > classes set the values and other do not. Additionally, open()/prepare() > of the abstract class is called, too, and set the default value if the > value was neither provided by the user, not by the derived class. > > The idiomatic way to update an immutable field like this in Clojure would be to use an atom. Here you could store the conf in an AtomicReference field, call .assoc on the map to update it, and .compareAndSet it on the AtomicReference. I'm not sure you'll need this, but I figured I'd mention it as how you would use a PersistentHashMap in your situation.
