testbed/src/main/java/org/cache2k/benchmark/prototype/evictionPolicies/C2k2xEviction.java
protected Entry findEvictionCandidate() {
    Entry hand = handCold;
    if (hotSize > getHotMax() || hand == null) {
      return runHandHot();
    }
    coldRunCnt++;
    int scanCnt = 1;
    if (hand.hitCnt > 0) {
      Entry evictFromHot = null;
      do {
        if (hotSize >= getHotMax() && handHot != null) {
          evictFromHot = runHandHot();
        }
        Entry e = hand;
        coldHits += e.hitCnt;
        e.hitCnt = 0;
        {
          hand = Entry.removeFromCyclicList(e);
          coldSize--;
          e.setHot(true);
          hotSize++;
          handHot = Entry.insertIntoTailCyclicList(handHot, e);
          reshuffleCnt++;
        }
        if (evictFromHot != null) {
          coldScanCnt += scanCnt;
          handCold = hand;
          return evictFromHot;
        }
        scanCnt++;
      } while (hand != null && hand.hitCnt > 0);
    }
    coldScanCnt += scanCnt;
    if (hand == null) {
      handCold = null;
      return runHandHot();
    }
    handCold = hand.next;
    return hand;
  }
/**
   * Runs cold hand an in turn hot hand to find eviction candidate.
   */
Runs cold hand an in turn hot hand to find eviction candidate.
Runs cold hand an in turn hot hand to find eviction candidate .
protected Entry findEvictionCandidate() {
    Entry hand = handCold;
    if (hotSize > getHotMax() || hand == null) {
      return runHandHot();
    }
    coldRunCnt++;
    int scanCnt = 1;
    if (hand.hitCnt > 0) {
      Entry evictFromHot = null;
      do {
        if (hotSize >= getHotMax() && handHot != null) {
          evictFromHot = runHandHot();
        }
        Entry e = hand;
        coldHits += e.hitCnt;
        e.hitCnt = 0;
        {
          hand = Entry.removeFromCyclicList(e);
          coldSize--;
          e.setHot(true);
          hotSize++;
          handHot = Entry.insertIntoTailCyclicList(handHot, e);
          reshuffleCnt++;
        }
        if (evictFromHot != null) {
          coldScanCnt += scanCnt;
          handCold = hand;
          return evictFromHot;
        }
        scanCnt++;
      } while (hand != null && hand.hitCnt > 0);
    }
    coldScanCnt += scanCnt;
    if (hand == null) {
      handCold = null;
      return runHandHot();
    }
    handCold = hand.next;
    return hand;
  }
protected Entry findEvictionCandidate ( ) { Entry hand = handCold ; if ( hotSize > getHotMax ( ) || hand == null ) { return runHandHot ( ) ; } coldRunCnt ++ ; int scanCnt = 1 ; if ( hand . hitCnt > 0 ) { Entry evictFromHot = null ; do { if ( hotSize >= getHotMax ( ) && handHot != null ) { evictFromHot = runHandHot ( ) ; } Entry e = hand ; coldHits += e . hitCnt ; e . hitCnt = 0 ; { hand = Entry . removeFromCyclicList ( e ) ; coldSize -- ; e . setHot ( true ) ; hotSize ++ ; handHot = Entry . insertIntoTailCyclicList ( handHot , e ) ; reshuffleCnt ++ ; } if ( evictFromHot != null ) { coldScanCnt += scanCnt ; handCold = hand ; return evictFromHot ; } scanCnt ++ ; } while ( hand != null && hand . hitCnt > 0 ) ; } coldScanCnt += scanCnt ; if ( hand == null ) { handCold = null ; return runHandHot ( ) ; } handCold = hand . next ; return hand ; }
Runs cold hand an in turn hot hand to find eviction candidate.
Runs cold hand an in turn hot hand to find eviction candidate .