Being without dfc.properties. Part II

Today I was asked a question related to previous post:

Hi, how to set dynamic values like dfc.data.dir? The value cannot be set via external property because DFC tells me “4545 [main] WARN com.documentum.fc.common.DfPreferences – [DFC_PREFERENCE_NOT_DYNAMIC] Persistent change for preference “dfc.data.dir” will not take effect until the next restart

Any idea how to fix that?
Thanks
Jens

Well, what is the difference between dynamic and non-dynamic DFC preferences? The answer is not trivial as it might seem at first glance. The short answer is: for one kind of preferences DFC has idea how to handle their changes in runtime, for another one it hasn’t, so, “other” preferences are marked as non-dynamic. DFC notifies other objects about changes in preferences through special observers, for example:

Groovy Shell (2.4.6, JVM: 1.8.0_60)
Type ':help' or ':h' for help.
---------------------------------------------------------------------------------
groovy:000> import com.documentum.fc.common.impl.preferences.IPreferencesObserver
===> ...
groovy:000> import com.documentum.fc.common.impl.preferences.TypedPreferences
===> ...
groovy:000> import com.documentum.fc.common.DfPreferences
===> ...
groovy:000> p = DfPreferences.getInstance()
===> DfPreferences@1dcca426
groovy:000> o = new IPreferencesObserver() { 
     void update (TypedPreferences preferences, String preferenceName) {
          println preferenceName + " has been changed"
     } 
}
===> groovysh_evaluate$1@3eff6846
groovy:000> p.addObserver(o)
===> null
groovy:000> p.setString("dfc.docbroker.host","docu72dev01")
dfc.docbroker.host has been changed
===> null

So, from programming perspective non-dynamic preferences are preferences which has no observer implementation responsible for their changes. However, “dynamic” is not a good term for dynamic preferences, because in certain cases DFC does not apply changes immediately, for example:

Groovy Shell (2.4.6, JVM: 1.8.0_60)
Type ':help' or ':h' for help.
---------------------------------------------------------
groovy:000> import com.documentum.fc.common.DfPreferences
===> ...
groovy:000> import com.documentum.fc.common.DfLoginInfo
===> ...
groovy:000> import com.documentum.com.DfClientX
===> ...
groovy:000> c = new DfClientX().getLocalClient()
===> com.documentum.fc.client.DfClient$ClientImpl@4dd752e8
groovy:000> c.newSession("DCTM_DEV",new DfLoginInfo("dmadmin","dmadmin"))
ERROR com.documentum.fc.client.DfServiceException:
[DM_DOCBROKER_E_NO_DOCBROKERS]error:  "No DocBrokers are configured"
        at com.documentum.fc.client.DfServiceException.newNoDocbrokersException (DfServiceException.java:44)
        at com.documentum.fc.client.impl.docbroker.ServerMapBuilder.getMap (ServerMapBuilder.java:50)
        at com.documentum.fc.client.impl.docbroker.DocbrokerClient.getServerMap (DocbrokerClient.java:152)
        at com.documentum.fc.client.impl.connection.docbase.ServerChoiceManager.updateServerChoices (ServerChoiceManager.java:159)
        at com.documentum.fc.client.impl.connection.docbase.ServerChoiceManager.updateServerChoicesIfNecessary (ServerChoiceManager.java:148)
        at com.documentum.fc.client.impl.connection.docbase.ServerChoiceManager.getServerChoices (ServerChoiceManager.java:47)
        at com.documentum.fc.client.impl.connection.docbase.DocbaseConnection.getServerChoices (DocbaseConnection.java:273)
        at com.documentum.fc.client.impl.connection.docbase.DocbaseConnection.establishNewRpcClient (DocbaseConnection.java:227)
        at com.documentum.fc.client.impl.connection.docbase.DocbaseConnection.open (DocbaseConnection.java:126)
        at com.documentum.fc.client.impl.connection.docbase.DocbaseConnection.<init> (DocbaseConnection.java:100)
        at com.documentum.fc.client.impl.connection.docbase.DocbaseConnection.<init> (DocbaseConnection.java:60)
        at com.documentum.fc.client.impl.connection.docbase.DocbaseConnectionFactory.newDocbaseConnection (DocbaseConnectionFactory.java:26)
        at com.documentum.fc.client.impl.connection.docbase.DocbaseConnectionManager.createNewConnection (DocbaseConnectionManager.java:180)
        at com.documentum.fc.client.impl.connection.docbase.DocbaseConnectionManager.getDocbaseConnection (DocbaseConnectionManager.java:110)
        at com.documentum.fc.client.impl.session.SessionFactory.newSession (SessionFactory.java:23)
        at com.documentum.fc.client.impl.session.SessionManager.getSessionFromFactory (SessionManager.java:134)
        at com.documentum.fc.client.impl.session.SessionManager.newSession (SessionManager.java:72)
        at com.documentum.fc.client.impl.session.SessionManager.getSession (SessionManager.java:191)
        at com.documentum.fc.client.DfClient$ClientImpl.newSession (DfClient.java:365)
        at com.documentum.fc.client.IDfClient$newSession.call (Unknown Source)
groovy:000> p = DfPreferences.getInstance()
===> DfPreferences@7c4a03a
groovy:000> p.setString("dfc.docbroker.host","docu72dev01")
===> null
groovy:000> c.newSession("DCTM_DEV",new DfLoginInfo("dmadmin","dmadmin"))
===> com.documentum.fc.client.impl.session.StrongSessionHandle@7efa366

but if you already have configured docbrokers and some repositories are registered on these docbrokres DFC will apply changes in “docbroker configuration” only after dfc.session.max_server_choice_age seconds (by default it is 5 minutes) because “docbroker configuration” is backed by a cache (note ServerChoiceManager.updateServerChoicesIfNecessary in stacktrace).

As regards to the question “whether we can setup non-dynamic preferences without using dfc.properties file”, the answer is yes, you can – just call DfPreferences#loadProperties(Properties, true) instead of DfPreferences#loadProperties(Properties, false) but you should understand what are you doing, check some examples below.

Accessing DfClient class two early causes “unexpected behaviour”

Groovy Shell (2.4.6, JVM: 1.8.0_60)
Type ':help' or ':h' for help.
---------------------------------------------------------
groovy:000> import com.documentum.fc.common.DfPreferences
===> ...
groovy:000> import com.documentum.fc.client.DfClient
===> ...
groovy:000> import com.documentum.fc.impl.RuntimeContext
===> ...
groovy:000> DfClient.class
===> class com.documentum.fc.client.DfClient
groovy:000> p = DfPreferences.getInstance()
===> DfPreferences@6cc44207
groovy:000> p.loadProperties(new Properties(["dfc.session.max_count":10]),true)
===> null
groovy:000> p.getString("dfc.session.max_count")
===> 10
groovy:000> r = RuntimeContext.getInstance()
===> com.documentum.fc.impl.RuntimeContext@dbca149
groovy:000> r.m_sessionFactory.m_connectionManager.m_maximumConnections
===> 1000

but:

Groovy Shell (2.4.6, JVM: 1.8.0_60)
Type ':help' or ':h' for help.
---------------------------------------------------------
groovy:000> import com.documentum.fc.common.DfPreferences
===> ...
groovy:000> import com.documentum.fc.client.DfClient
===> ...
groovy:000> import com.documentum.fc.impl.RuntimeContext
===> ...
groovy:000> p = DfPreferences.getInstance()
===> DfPreferences@2cdb5974
groovy:000> p.loadProperties(new Properties(["dfc.session.max_count":10]),true)
===> null
groovy:000> p.getString("dfc.session.max_count")
===> 10
groovy:000> r = RuntimeContext.getInstance()
===> com.documentum.fc.impl.RuntimeContext@696105c4
groovy:000> r.m_sessionFactory.m_connectionManager.m_maximumConnections
===> 10

calling DfPreferences#loadProperties(Properties, true) multiple times erases previously set up preferences:

groovy:000> p.loadProperties(new Properties(["dfc.session.max_count":10]),true)
===> null
groovy:000> p.getString("dfc.session.max_count")
===> 10
groovy:000> p.loadProperties(new Properties(["dfc.docbroker.host":"docu72dev01"]),true)
===> null
groovy:000> p.getString("dfc.session.max_count")
===> 1000
groovy:000> p.getString("dfc.docbroker.host")
===> docu72dev01
groovy:000> p.loadProperties(new Properties(["dfc.docbroker.host":"docu72dev01","dfc.session.max_count":10]),true)
===> null
groovy:000> p.getString("dfc.docbroker.host")
===> docu72dev01
groovy:000> p.getString("dfc.session.max_count")
===> 10

2 thoughts on “Being without dfc.properties. Part II

  1. Thanks for clarification, that did it. Powerful integration in our app is now possible.
    Would help if EMC would provide such a documentation…

    Like

  2. Pingback: Side effects of dfc.diagnostics.resources.enable | Documentum in a (nuts)HELL

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s