Uploaded image for project: 'Kuali Rice Development'
  1. Kuali Rice Development
  2. KULRICE-4414

When using the method getReportQueryIteratorByQuery, call releaseDbResources() to avoid INFO messages in the log

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.0.3
    • Component/s: Development
    • Labels:
      None

      Description

      To avoid the following INFO message in the logs, the method releaseDbResources() should be called once the iterator is no longer needed.

      2010-06-03 12:59:44,051 [Finalizer] D: U: INFO org.apache.ojb.broker.accesslayer.ReportQueryRsIterator :: Found unclosed resources while finalize (causer class: org.apache.ojb.broker.accesslayer.ReportQueryRsIterator) Do automatic cleanup

        Attachments

          Activity

          Hide
          sajmera Saurabh Ajmera (Inactive) added a comment -

          Shannon Hess added a comment - 03/Jun/10 03:21 PM
          Example of one I changed in DocumentTypeDAOOjbImpl.java to avoid multiple logs when documents are requeued.

          public Long findDocumentTypeIdByDocumentId(Long documentId) {
          Criteria crit = new Criteria();
          crit.addEqualTo("routeHeaderId", documentId);
          ReportQueryByCriteria query = QueryFactory.newReportQuery(DocumentRouteHeaderValue.class, crit);
          query.setAttributes(new String[]

          { "documentTypeId" });
          /**
          * Begin IU Customization
          * 06-3-2010 - Shannon Hess
          *
          * EN-1904 - add call to releaseDbResources()
          */
          RsIterator iter = (RsIterator)getPersistenceBrokerTemplate().getReportQueryIteratorByQuery(query);

          while (iter.hasNext()) { Object[] row = (Object[]) iter.next(); BigDecimal id = (BigDecimal)row[0]; iter.releaseDbResources(); return new Long(id.longValue()); }
          iter.releaseDbResources();
          /**
          * End IU Customization
          */
          return null;
          }
          [ Show » ]
          Shannon Hess added a comment - 03/Jun/10 03:21 PM Example of one I changed in DocumentTypeDAOOjbImpl.java to avoid multiple logs when documents are requeued. public Long findDocumentTypeIdByDocumentId(Long documentId) { Criteria crit = new Criteria(); crit.addEqualTo("routeHeaderId", documentId); ReportQueryByCriteria query = QueryFactory.newReportQuery(DocumentRouteHeaderValue.class, crit); query.setAttributes(new String[] { "documentTypeId" }

          ); /** * Begin IU Customization * 06-3-2010 - Shannon Hess * * EN-1904 - add call to releaseDbResources() */ RsIterator iter = (RsIterator)getPersistenceBrokerTemplate().getReportQueryIteratorByQuery(query); while (iter.hasNext())

          { Object[] row = (Object[]) iter.next(); BigDecimal id = (BigDecimal)row[0]; iter.releaseDbResources(); return new Long(id.longValue()); }

          iter.releaseDbResources(); /** * End IU Customization */ return null; }

          Show
          sajmera Saurabh Ajmera (Inactive) added a comment - Shannon Hess added a comment - 03/Jun/10 03:21 PM Example of one I changed in DocumentTypeDAOOjbImpl.java to avoid multiple logs when documents are requeued. public Long findDocumentTypeIdByDocumentId(Long documentId) { Criteria crit = new Criteria(); crit.addEqualTo("routeHeaderId", documentId); ReportQueryByCriteria query = QueryFactory.newReportQuery(DocumentRouteHeaderValue.class, crit); query.setAttributes(new String[] { "documentTypeId" }); /** * Begin IU Customization * 06-3-2010 - Shannon Hess * * EN-1904 - add call to releaseDbResources() */ RsIterator iter = (RsIterator)getPersistenceBrokerTemplate().getReportQueryIteratorByQuery(query); while (iter.hasNext()) { Object[] row = (Object[]) iter.next(); BigDecimal id = (BigDecimal)row[0]; iter.releaseDbResources(); return new Long(id.longValue()); } iter.releaseDbResources(); /** * End IU Customization */ return null; } [ Show » ] Shannon Hess added a comment - 03/Jun/10 03:21 PM Example of one I changed in DocumentTypeDAOOjbImpl.java to avoid multiple logs when documents are requeued. public Long findDocumentTypeIdByDocumentId(Long documentId) { Criteria crit = new Criteria(); crit.addEqualTo("routeHeaderId", documentId); ReportQueryByCriteria query = QueryFactory.newReportQuery(DocumentRouteHeaderValue.class, crit); query.setAttributes(new String[] { "documentTypeId" } ); /** * Begin IU Customization * 06-3-2010 - Shannon Hess * * EN-1904 - add call to releaseDbResources() */ RsIterator iter = (RsIterator)getPersistenceBrokerTemplate().getReportQueryIteratorByQuery(query); while (iter.hasNext()) { Object[] row = (Object[]) iter.next(); BigDecimal id = (BigDecimal)row[0]; iter.releaseDbResources(); return new Long(id.longValue()); } iter.releaseDbResources(); /** * End IU Customization */ return null; }

            People

            • Assignee:
              sajmera Saurabh Ajmera (Inactive)
              Reporter:
              sajmera Saurabh Ajmera (Inactive)
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: