Author: oheger
Date: Tue Nov 29 21:01:57 2016
New Revision: 1771957

URL: http://svn.apache.org/viewvc?rev=1771957&view=rev
Log:
[CONFIGURATION-643] Improved user's guide for concurrency.

As requested on the user ML, the description how to set a
synchronizer on a Configuration instance could be improved.

Modified:
    
commons/proper/configuration/trunk/src/site/xdoc/userguide/howto_concurrency.xml

Modified: 
commons/proper/configuration/trunk/src/site/xdoc/userguide/howto_concurrency.xml
URL: 
http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/site/xdoc/userguide/howto_concurrency.xml?rev=1771957&r1=1771956&r2=1771957&view=diff
==============================================================================
--- 
commons/proper/configuration/trunk/src/site/xdoc/userguide/howto_concurrency.xml
 (original)
+++ 
commons/proper/configuration/trunk/src/site/xdoc/userguide/howto_concurrency.xml
 Tue Nov 29 21:01:57 2016
@@ -94,6 +94,24 @@
 config.setSynchronizer(new ReadWriteSynchronizer());
 ]]></source>
     <p>
+      Rather than setting the synchronizer on an existing
+      <code>Configuration</code> instance, it is usually better to configure
+      the <a href="howto_builder.html">configuration builder</a> responsible
+      for the creation of the configuration to set the correct synchronizer
+      directly after a new instance has been created. This is done in the usual
+      way by setting the corresponding property of a parameters object passed
+      to the builder's <code>configure()</code> method, for instance:
+    </p>
+<source><![CDATA[
+Parameters params = new Parameters();
+BasicConfigurationBuilder<PropertiesConfiguration> builder =
+        new BasicConfigurationBuilder<PropertiesConfiguration>(
+                PropertiesConfiguration.class)
+                .configure(params.basic()
+                        .setSynchronizer(new ReadWriteSynchronizer());
+PropertiesConfiguration config = builder.getConfiguration();
+]]></source>
+    <p>
       It is also possible to set the synchronizer to <strong>null</strong>. In
       this case, the default <code>NoOpSynchronizer</code> is installed, which
       means that the configuration is no longer protected against concurrent


Reply via email to