6 Replies Latest reply on Nov 2, 2005 11:44 AM by Charles Crouch

    question on effect of various empty elements in -ds.xml

    Charles Crouch Expert

      Could someone please tell me the effect of putting the following empty elements into a -ds.xml file.

      a) <track-statements/>

      b) <transaction-isolation/>

      c) <isSameRM-override-value/>

      My guesses....

      a) same as <track-statements>true</track-statements>

      b) same as if no transaction-isolation element was specified, i.e. use the databases default txn isolation level

      c) same as if no isSameRM-override-value element was specified, i.e. don't override isSameRM()


      Thanks very much

        • 1. Re: question on effect of various empty elements in -ds.xml
          Adrian Brock Master

          Well done. Why guess when you "suck it and see" or read the code?

          • 2. Re: question on effect of various empty elements in -ds.xml
            Adrian Brock Master

            And for the future reference of all those that don't want to do their own work.

            a) BaseWrapperManagedConnectonFactory.setTrackStatements(String)

             public void setTrackStatements(String value)
             {
             if (value == null)
             throw new IllegalArgumentException("Null value for trackStatements");
             String trimmed = value.trim();
             if (trimmed.equalsIgnoreCase(TRACK_STATEMENTS_FALSE))
             trackStatements = TRACK_STATEMENTS_FALSE_INT;
             else if (trimmed.equalsIgnoreCase(TRACK_STATEMENTS_TRUE))
             trackStatements = TRACK_STATEMENTS_TRUE_INT;
             else
             trackStatements = TRACK_STATEMENTS_NOWARN_INT;
             }
            

            Answer: NOWARN (at least since that has been the default)

            b) BaseWrapperManagedConnection.setIsolationLevel(String)
            
             public void setTransactionIsolation(String transactionIsolation)
             {
             if (transactionIsolation.equals("TRANSACTION_NONE"))
             this.transactionIsolation = Connection.TRANSACTION_NONE;
             else if (transactionIsolation.equals("TRANSACTION_READ_COMMITTED"))
             this.transactionIsolation = Connection.TRANSACTION_READ_COMMITTED;
             else if (transactionIsolation.equals("TRANSACTION_READ_UNCOMMITTED"))
             this.transactionIsolation = Connection.TRANSACTION_READ_UNCOMMITTED;
             else if (transactionIsolation.equals("TRANSACTION_REPEATABLE_READ"))
             this.transactionIsolation = Connection.TRANSACTION_REPEATABLE_READ;
             else if (transactionIsolation.equals("TRANSACTION_SERIALIZABLE"))
             this.transactionIsolation = Connection.TRANSACTION_SERIALIZABLE;
             else
             {
             try
             {
             this.transactionIsolation = Integer.parseInt(transactionIsolation);
             }
             catch (NumberFormatException nfe)
             {
             throw new IllegalArgumentException("Setting Isolation level to unknown state: " + transactionIsolation);
             }
             }
             }
            

            Answer: IllegalArgumentException
            However: http://jira.jboss.com/jira/browse/JBAS-2048

            c) isSameRM-override-value

             <xsl:if test="isSameRM-override-value">
             <config-property name="IsSameRMOverrideValue" type="java.lang.Boolean"><xsl:value-of select="normalize-space(isSameRM-override-value)"/></config-property>
             </xsl:if>
            


            Answer: Boolean.valueOf("") == false

            • 4. Re: question on effect of various empty elements in -ds.xml
              Charles Crouch Expert

              Thanks for the info. So we have

              a) <track-statements/> ==> <track-statements>nowarn</track-statements> (at least for 3.2.6 onwards)

              and

              c) <isSameRM-override-value/> ==> <isSameRM-override-value>false</isSameRM-override-value>

              Forgive me, but I'm a little confused about b). I tested with a Sept-14th version of HEAD and <transaction-isolation>WRONG</transaction-isolation> produces an IllegalArgumentException, but with <transaction-isolation/> there is no such exception. I've looked through the comments in http://jira.jboss.com/jira/browse/JBAS-2048 and can't see anything which sheds light on this specific scenario.

              Thanks very much

              • 5. Re: question on effect of various empty elements in -ds.xml
                Adrian Brock Master

                Ok. So I was wrong as well, you should have a debug message:

                org.jboss.resource.connectionmanager.RARDeployment

                protected void setMcfProperties(Collection properties, boolean mustExist) throws DeploymentException
                 {
                 for (Iterator i = properties.iterator(); i.hasNext();)
                 {
                 ConfigPropertyMetaData cpmd = (ConfigPropertyMetaData) i.next();
                 String name = cpmd.getName();
                 String type = cpmd.getType();
                 String value = cpmd.getValue();
                 if (name == null || name.length() == 0 || value == null || value.length() == 0)
                 {
                 log.debug("Not setting config property '" + name + "'");
                 continue;
                 }
                

                Which means that any MCF property that has "" as a value is ignored
                and the default will be used.

                • 6. Re: question on effect of various empty elements in -ds.xml
                  Charles Crouch Expert

                  Thanks, for the clarification. Turning on debug logging for RARDeployment and using the following -ds.xml

                  <datasources>
                   <xa-datasource>
                   <jndi-name>test_xa</jndi-name>
                   <xa-datasource-class>org.hsqldb.jdbcDriver</xa-datasource-class>
                   <password></password>
                   <track-statements/>
                   <transaction-isolation/>
                   <isSameRM-override-value/>
                   </xa-datasource>
                  </datasources>
                  


                  gave

                  2005-11-02 10:29:04,463 DEBUG [org.jboss.resource.connectionmanager.RARDeployment] setting property: XADataSourceClass to value org.hsqldb.jdbcDriver
                  2005-11-02 10:29:04,463 DEBUG [org.jboss.resource.connectionmanager.RARDeployment] set property XADataSourceClass to value org.hsqldb.jdbcDriver
                  2005-11-02 10:29:04,463 DEBUG [org.jboss.resource.connectionmanager.RARDeployment] Not setting config property 'XADataSourceProperties'
                  2005-11-02 10:29:04,463 DEBUG [org.jboss.resource.connectionmanager.RARDeployment] Not setting config property 'IsSameRMOverrideValue'
                  2005-11-02 10:29:04,463 DEBUG [org.jboss.resource.connectionmanager.RARDeployment] Not setting config property 'TransactionIsolation'
                  2005-11-02 10:29:04,463 DEBUG [org.jboss.resource.connectionmanager.RARDeployment] Not setting config property 'Password'
                  2005-11-02 10:29:04,463 DEBUG [org.jboss.resource.connectionmanager.RARDeployment] Not setting config property 'TrackStatements'


                  So that means we have...


                  a) <track-statements/> ==> same as if no track-statements element was specified, i.e. use the default tracking of 'nowarn'.

                  b) <transaction-isolation/> ==> same as if no transaction-isolation element was specified, i.e. use the databases default txn isolation level

                  c) <isSameRM-override-value/> ==> same as if no isSameRM-override-value element was specified, i.e. don't override isSameRM()


                  Thanks very much