deltaspike-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From build...@apache.org
Subject svn commit: r988545 - in /websites/staging/deltaspike/trunk/content: ./ documentation/configuration.html
Date Wed, 18 May 2016 17:22:50 GMT
Author: buildbot
Date: Wed May 18 17:22:50 2016
New Revision: 988545

Log:
Staging update by buildbot for deltaspike

Modified:
    websites/staging/deltaspike/trunk/content/   (props changed)
    websites/staging/deltaspike/trunk/content/documentation/configuration.html

Propchange: websites/staging/deltaspike/trunk/content/
------------------------------------------------------------------------------
--- cms:source-revision (original)
+++ cms:source-revision Wed May 18 17:22:50 2016
@@ -1 +1 @@
-1742010
+1744440

Modified: websites/staging/deltaspike/trunk/content/documentation/configuration.html
==============================================================================
--- websites/staging/deltaspike/trunk/content/documentation/configuration.html (original)
+++ websites/staging/deltaspike/trunk/content/documentation/configuration.html Wed May 18
17:22:50 2016
@@ -592,6 +592,32 @@ Custom types can be supported by providi
 </div>
 </div>
 </div>
+<div class="sect3">
+<h4 id="_dynamic_reloading">Dynamic Reloading</h4>
+<div class="paragraph">
+<p>The TypedResolver can also be used to efficiently cache configured values.
+That way you can pick up configuration which might get changed during runtime on the fly.
+E.g. if you have a ConfigSource which picks up the values from a database table.
+Instead of resolving the configured value at the beginning you simply invoke <code>.getValue()</code>
on your TypedResolver each time you need the value.</p>
+</div>
+<div class="listingblock">
+<div class="title">Working with dynamically changing values</div>
+<div class="content">
+<pre class="CodeRay highlight"><code data-lang="java"><span class="directive">private</span>
ConfigResolver.TypedResolver&lt;<span class="predefined-type">String</span>&gt;
urlConfig
+    = ConfigResolver.resolve(<span class="string"><span class="delimiter">&quot;</span><span
class="content">myapp.some.remote.rest.url</span><span class="delimiter">&quot;</span></span>)
+                    .logChanges(<span class="predefined-constant">true</span>)
+                    .cacheFor(<span class="predefined-type">TimeUnit</span>.MINUTES,
<span class="integer">5</span>);
+
+...
+
+connecTo( urlConfig.getValue() );</code></pre>
+</div>
+</div>
+<div class="paragraph">
+<p>The sample above will log any value changes in the configuration (<code>logChanges(true)</code>)
and internally cache the configured value for 5 minutes (<code>cacheFor(TimeUnit.MINUTES,
5)</code>).
+Only after that time the configured value will get evaluate again.</p>
+</div>
+</div>
 </div>
 <div class="sect2">
 <h3 id="_injection_of_configured_values_into_beans_using_configproperty">Injection
of configured values into beans using @ConfigProperty</h3>
@@ -977,6 +1003,7 @@ log.</p>
 <li><a href="#_typedresolver_api">TypedResolver API</a>
 <ul class="sectlevel3">
 <li><a href="#_supported_types">Supported types</a></li>
+<li><a href="#_dynamic_reloading">Dynamic Reloading</a></li>
 </ul>
 </li>
 <li><a href="#_injection_of_configured_values_into_beans_using_configproperty">Injection
of configured values into beans using @ConfigProperty</a>



Mime
View raw message