← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 17437: Approval. Initializing hashcode for option combo before putting into cache. If later accessed fro...

 

------------------------------------------------------------
revno: 17437
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2014-11-11 15:45:09 +0100
message:
  Approval. Initializing hashcode for option combo before putting into cache. If later accessed from cache there will be no session. Not pretty but works for now.
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryOptionCombo.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataapproval/hibernate/HibernateDataApprovalStore.java
  dhis-2/dhis-services/dhis-service-datamart-default/src/test/java/org/hisp/dhis/datamart/crosstab/CrossTabServiceTest.java
  dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/grid/ListGrid.java


--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk

Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryOptionCombo.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryOptionCombo.java	2014-10-13 05:01:18 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryOptionCombo.java	2014-11-11 14:45:09 +0000
@@ -290,6 +290,12 @@
 
         return map;
     }
+    
+    public DataElementCategoryOptionCombo initialize()
+    {
+        this.hashCode();
+        return this;
+    }
 
     // -------------------------------------------------------------------------
     // Getters and setters

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataapproval/hibernate/HibernateDataApprovalStore.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataapproval/hibernate/HibernateDataApprovalStore.java	2014-11-10 17:02:36 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataapproval/hibernate/HibernateDataApprovalStore.java	2014-11-11 14:45:09 +0000
@@ -86,11 +86,11 @@
     private static final Log log = LogFactory.getLog( HibernateDataApprovalStore.class );
 
     private static Cache<Integer, DataElementCategoryOptionCombo> OPTION_COMBO_CACHE = CacheBuilder.newBuilder()
-            .expireAfterAccess( 10, TimeUnit.MINUTES ).initialCapacity( 10000 )
+            .expireAfterAccess( 15, TimeUnit.MINUTES ).initialCapacity( 5000 )
             .maximumSize( 50000 ).build();
 
     private static Cache<Integer, OrganisationUnit> ORG_UNIT_CACHE = CacheBuilder.newBuilder()
-            .expireAfterAccess( 10, TimeUnit.MINUTES ).initialCapacity( 10000 )
+            .expireAfterAccess( 15, TimeUnit.MINUTES ).initialCapacity( 5000 )
             .maximumSize( 50000 ).build();
 
     // -------------------------------------------------------------------------
@@ -404,7 +404,7 @@
                 {
                     public DataElementCategoryOptionCombo call() throws ExecutionException
                     {
-                        return categoryService.getDataElementCategoryOptionCombo( aoc );
+                        return categoryService.getDataElementCategoryOptionCombo( aoc ).initialize();
                     }
                 } ) );
 

=== modified file 'dhis-2/dhis-services/dhis-service-datamart-default/src/test/java/org/hisp/dhis/datamart/crosstab/CrossTabServiceTest.java'
--- dhis-2/dhis-services/dhis-service-datamart-default/src/test/java/org/hisp/dhis/datamart/crosstab/CrossTabServiceTest.java	2014-11-11 12:58:17 +0000
+++ dhis-2/dhis-services/dhis-service-datamart-default/src/test/java/org/hisp/dhis/datamart/crosstab/CrossTabServiceTest.java	2014-11-11 14:45:09 +0000
@@ -246,7 +246,7 @@
         valueList.add( 1 );
         valueList.add( 1 );
 
-        for ( DataElementOperand operand1 : operands )
+        for ( int i = 0; i < operands.size(); i++ )
         {
             valueList.add( 10.0 );
         }

=== modified file 'dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/grid/ListGrid.java'
--- dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/grid/ListGrid.java	2014-11-11 12:58:17 +0000
+++ dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/grid/ListGrid.java	2014-11-11 14:45:09 +0000
@@ -421,7 +421,7 @@
             throw new IllegalStateException( "Number of column values (" + columnValues.size() + ") is not equal to number of rows (" + grid.size() + ")" );
         }
 
-        for ( List<Object> aGrid : grid )
+        for ( int i = 0; i < grid.size(); i++ )
         {
             grid.get( rowIndex++ ).add( columnValues.get( columnIndex++ ) );
         }