All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.gemstone.gemfire.internal.cache.lru.LRUMapCallbacks Maven / Gradle / Ivy

The newest version!
/*
 * Copyright (c) 2010-2015 Pivotal Software, Inc. All rights reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License"); you
 * may not use this file except in compliance with the License. You
 * may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
 * implied. See the License for the specific language governing
 * permissions and limitations under the License. See accompanying
 * LICENSE file.
 */
package com.gemstone.gemfire.internal.cache.lru;

//import com.gemstone.gemfire.cache.Region;
import com.gemstone.gemfire.internal.cache.RegionEntry;
//import com.gemstone.gemfire.internal.cache.LocalRegion;

/** The lru action on the map for evicting items must be called while the current thread is free of any map synchronizations.
 */
public interface LRUMapCallbacks {

  /** to be called by LocalRegion after any synchronization surrounding a map.put or map.replace call is made.
   * This will then perform the lru removals, or region.localDestroy() calls to make up for the recent addition. 
   */
  public void lruUpdateCallback();

  public void lruUpdateCallback(int n);
  /**
   * Disables lruUpdateCallback in calling thread
   * @return false if it's already disabled
   */
  public boolean disableLruUpdateCallback();
  /**
   * Enables lruUpdateCallback in calling thread
   */
  public void enableLruUpdateCallback();

  /* no longer used in the new TX impl
  /**
   * Decrements the transaction reference count
   * which prevents LRU eviction from causing
   * transactional conflicts
   *
  public void lruDecRefCount(RegionEntry e);
  */

  /** if an exception occurs between an LRUEntriesMap put and the call to lruUpdateCallback, then this must be
   * called to allow the thread to continue to work with other regions.
   */
  public void resetThreadLocals();

  /**
   * Return true if the lru has exceeded its limit and needs to evict.
   * Note that this method is currently used to prevent disk recovery from faulting
   * in values once the limit is exceeded.
   */
  public boolean lruLimitExceeded();

  public void lruCloseStats();
  
  /**
   * Called when an entry is faulted in from disk.
   */
  public void lruEntryFaultIn(LRUEntry entry);
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy