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;
 
An evictor for a private cache. [#21330]
public class PrivateEvictor extends Evictor {
    public PrivateEvictor(EnvironmentImpl envImpl) {
        super(envImpl);
    }
    @Override
        return new PrivateSelector();
    }

    
PrivateEvictor implements a DbCache simply using a HashMap, like cleaner.FileProcessor and other components. (SharedEvictor has a more complex implemention.)
    @Override
    DbCache createDbCache() {
        return new DbCache() {
            final Map<DatabaseIdDatabaseImplmap =
                new HashMap<DatabaseIdDatabaseImpl>();
            int nOperations = 0;
            public DatabaseImpl getDb(EnvironmentImpl envImpl,
                                      DatabaseId dbId) {
                assert envImpl == PrivateEvictor.this.;
                /*
                 * Clear DB cache after dbCacheClearCount operations, to
                 * prevent starving other threads that need exclusive access to
                 * the MapLN (for example, DbTree.deleteMapLN).  [#21015]
                 */
                 += 1;
                if (( % ) == 0) {
                    releaseDbs();
                }
                return envImpl.getDbTree().getDb(dbId, -1, );
            }
            public void releaseDbs() {
                .getDbTree().releaseDbs();
                .clear();
            }
        };
    }
New to GrepCode? Check out our FAQ X