I hava a multithreaded application with large, nested xml configuration file. I look for 'clean' way of reconfiguring whole app so that all worker threads would use 'fresh' config simultaneously.
I see several ways:
1) create one shared singleton config class through which i would access my values, i.e.:
# this instance is common for all threads
2) use non-shared singleton object per each thread and
add custom signal handler that would reload configuration data. When main thread would found that config was chaged it would send this signal to all workers. But! for N workers this process would execute N times just to fetch the same content (then parse and validate it)...
Is there any other way? And which is the best?