...
Here, we declaratively build the RegionConfig.Index
object we would like to add to the configuration.
On successfull creation, we search for the RegionConfig
object to which the index configuration should belong and add this index to that array.
With the mutator defined, we execute (a concurrency-safe) update to the cluster configuration.
Comments
Common operations, such as the above "find region config", could also be considered for initial inclusion to the public API.
The use of UnaryOperator<CacheConfig>
could be replaced by a direct assignment, i.e., updateCacheConfig("cluster", myNewCacheConfig).
While this might present a cleaner API, it would also allow for race conditions between concurrent modifications of the configuration.
Long-term Goals
- Reduce duplication of effort by replacing "creation" classes (i.e.,
CacheCreation
,RegionCreation
,BindingCreation
, et al) with JAXB-generated classes. - Remove requirement of JAXB / XML annotations on configuration element classes.