Uploaded image for project: 'JBoss Enterprise Application Platform 4 and 5'
  1. JBoss Enterprise Application Platform 4 and 5
  2. JBPAPP-9237

Cannot enable setQueryTimeout when query-timeout set in datasource configuration

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Minor
    • EAP_EWP 5.2.0
    • EAP_EWP 5.1.2
    • JCA
    • None
    • Release Notes
    • Hide
      If an application called the setQueryTimeout() method on a statement object, the database query time-out did not become effective. This happened when query-timeout was set in the data-source configuration. With this update, the time-out query is overwritten by the application that called the setQueryTimeout() method as expected.
      Show
      If an application called the setQueryTimeout() method on a statement object, the database query time-out did not become effective. This happened when query-timeout was set in the data-source configuration. With this update, the time-out query is overwritten by the application that called the setQueryTimeout() method as expected.
    • Documented as Resolved Issue
    • NEW

    Description

      The Statement#setQueryTimeout in customer application cannot be enabled when the query-timeout set in datasource configuration.
      The WrappedPreparedStatement#checkConfiguredQueryTimeout is called in the Statement#execute timing and the query-timeout value is set to the Statement#setQueryTimeout. Therefore, the setQueryTimeout value set by customer application before the Statement#execute does not become effective.

      WrappedPreparedStatement.java
      290#   public boolean execute() throws SQLException
      291#   {
      292#      lock();
      293#      try
      294#      {
      295#         checkTransaction();
      296#         try 
      297#         {
      298#            checkConfiguredQueryTimeout();
      299#            return ps.execute();         
      300#         }
      301#         catch (Throwable t)
      302#         {
      303#            throw checkException(t);
      304#         }
      305#      }
      306#      finally
      307#      {
      308#         unlock();
      309#      }
      310#   }
      
      934#   void checkConfiguredQueryTimeout(WrappedStatement ws) throws SQLException
      935#   {
      936#      if (mc == null || dataSource == null)
      937#         return;
      938#
      939#      int timeout = 0; 
      940#      
      941#      // Use the transaction timeout
      942#      if (mc.isTransactionQueryTimeout())
      943#         timeout = dataSource.getTimeLeftBeforeTransactionTimeout();
      944#      
      945#      // Look for a configured value
      946#      if (timeout <= 0)
      947#         timeout = mc.getQueryTimeout();
      948#      
      949#      if (timeout > 0)
      950#         ws.setQueryTimeout(timeout);
      951#   }
      

      [WrappedPreparedStatement.java] http://anonsvn.jboss.org/repos/jbossas/tags/JBPAPP_5_1_2_GA/connector/src/main/org/jboss/resource/adapter/jdbc/WrappedPreparedStatement.java

      Attachments

        Issue Links

          Activity

            People

              jpederse@redhat.com Jesper Pedersen
              rhn-support-enagai Eiichi Nagai (Inactive)
              Eva Kopalova Eva Kopalova (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: