Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*-
   * See the file LICENSE for redistribution information.
   *
   * Copyright (c) 2002, 2013 Oracle and/or its affiliates.  All rights reserved.
   *
   */
  
  package com.sleepycat.je.evictor;
  
 
The standard eviction selector that operates on the INList for a single environment. A single iterator over the INList is used to implement getNextIN.
 
 class PrivateSelector extends TargetSelector {
 
     private final EnvironmentImpl envImpl;
 
     private Iterator<INscanIter;
 
     public PrivateSelector(EnvironmentImpl envImpl
         throws DatabaseException {
 
         super(envImpl);
         this. = envImpl;
          = null;
     }
 
     @Override
     public StatGroup loadStats(StatsConfig config) {
         return super.loadStats(config);
     }

    
Do nothing.
 
     @Override
     public void noteINListChange(int nINs) {
     }

    
Initializes the iterator, and performs special eviction once per batch.
 
     @Override
     synchronized SetupInfo startBatch(boolean doSpecialEviction)
         throws DatabaseException {
 
         SetupInfo setupInfo = new SetupInfo();
 
         if ( == null) {
              = .getInMemoryINs().iterator();
         }
 
         /* Perform special eviction without holding any latches. */
         if (doSpecialEviction){
             setupInfo.specialEvictionBytes = .specialEviction();
         }
 
         setupInfo.maxINsPerBatch = .getInMemoryINs().getSize();
         return setupInfo;
     }

    
Returns the next IN, wrapping if necessary.
 
     @Override
     IN getNextIN() {
         if (.getMemoryBudget().isTreeUsageAboveMinimum()) {
             if (!.hasNext()) {
                  = .getInMemoryINs().iterator();
             }
             return .hasNext() ? .next() : null;
         } 
         
         return null;
     }

    
Return stats for the single INList covered by this evictor.
 
     @Override
     StatGroup getINListStats(StatsConfig config) {
         return .getInMemoryINs().loadStats();
     }
 
     /* For unit testing only. */
     @Override
     Iterator<INgetScanIterator() {
         return ;
     }
    /* For unit testing only. */
    @Override
    void setScanIterator(Iterator<INiter) {
         = iter;
    }

    
Only supported by SharedSelector.
    @Override
    public void addEnvironment(EnvironmentImpl unused) {
        throw EnvironmentFailureException.unexpectedState();
    }

    
Only supported by SharedSelector.
    @Override
    public void removeEnvironment(EnvironmentImpl unused) {
        throw EnvironmentFailureException.unexpectedState();
    }

    
Only supported by SharedSelector.
    @Override
    public boolean checkEnv(EnvironmentImpl env) {
        throw EnvironmentFailureException.unexpectedState();
    }
New to GrepCode? Check out our FAQ X