From: Dain S. <dsu...@us...> - 2002-06-19 17:28:41
|
User: dsundstrom Date: 02/06/19 10:28:40 Modified: src/main/org/jboss/ejb/plugins/cmp/jdbc Tag: Branch_3_0 ReadAheadCache.java Log: Applied patch from bug [ 569077 ] read-ahead issues. Fixes slow comparison code when checking for dereferenced entities. Only allows results with two or more PKs to be added to the cache. Revision Changes Path No revision No revision 1.5.2.3 +27 -9 jboss/src/main/org/jboss/ejb/plugins/cmp/jdbc/ReadAheadCache.java Index: ReadAheadCache.java =================================================================== RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/ejb/plugins/cmp/jdbc/ReadAheadCache.java,v retrieving revision 1.5.2.2 retrieving revision 1.5.2.3 diff -u -r1.5.2.2 -r1.5.2.3 --- ReadAheadCache.java 25 May 2002 23:22:48 -0000 1.5.2.2 +++ ReadAheadCache.java 19 Jun 2002 17:28:39 -0000 1.5.2.3 @@ -81,7 +81,7 @@ List results, JDBCReadAheadMetaData readahead) { - if(results.isEmpty()) { + if(results.size() < 2) { // nothing to see here... move along return; } @@ -134,13 +134,31 @@ if(dereferencedResults.isEmpty()) { return; } - - // remove all lists from the dereferenced set that are still referenced - // in the listMap - iter = listMap.values().iterator(); - while(iter.hasNext()) { - EntityMapEntry entry = (EntityMapEntry)iter.next(); - dereferencedResults.remove(entry.results); + + // + // Go through the dereferenced results set and look at the PKs for each + // dereferenced list. If you find one key that references the + // dereferenced list, remove it from the dereferenced results set and + // move on to the next dereferenced results. + // + iter = dereferencedResults.iterator(); + while (iter.hasNext()) { + List dereferencedList = (List) iter.next(); + + boolean listHasReference = false; + Iterator iter2 = dereferencedList.iterator(); + while (!listHasReference && + iter2.hasNext()) { + EntityMapEntry entry = (EntityMapEntry) listMap.get(iter2.next()); + if(entry != null && entry.results == dereferencedList) { + listHasReference = true; + } + } + + if(listHasReference) { + // this list does not have any references + iter.remove(); + } } // if we don't have any dereferenced results at this point we are done |