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

com.gemstone.gemfire.management.EvictionAttributesData Maven / Gradle / Ivy

There is a newer version: 2.0-BETA
Show 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.management;

import java.beans.ConstructorProperties;

import com.gemstone.gemfire.cache.EvictionAction;
import com.gemstone.gemfire.cache.EvictionAlgorithm;
import com.gemstone.gemfire.cache.EvictionAttributes;
import com.gemstone.gemfire.cache.Region;
/**
 * Composite data type used to distribute the eviction attributes for
 * a {@link Region}.
 * 
 * @author rishim
 * @since 7.0
 */

public class EvictionAttributesData {
  
  /**
   * Algorithm used for eviction
   */
  private String algorithm;

  /**
   * Maximum entries in Region before eviction starts
   */
  private Integer maximum;

  /**
   * Action to be taken if entries reaches maximum value
   */
  private String action;
  
  @ConstructorProperties( { "algorithm", "maximum", "action"

  })
  public EvictionAttributesData(String algorithm, Integer maximum, String action){
    this.algorithm = algorithm;
    this.maximum = maximum;
    this.action = action;
  }

  /**
   * Returns the algorithm (policy) used to determine which entries will be
   * evicted.
   */
  public String getAlgorithm() {
    return algorithm;
  }

  /**
   * The unit of this value is determined by the definition of the {@link EvictionAlgorithm} set by one of the creation
   * methods e.g. {@link EvictionAttributes#createLRUEntryAttributes()}
   *
   * For algorithm LRU HEAP null will be returned
   * @return maximum value used by the {@link EvictionAlgorithm} which determines when the {@link EvictionAction} is
   *         performed.
   */
  public Integer getMaximum() {
    return maximum;
  }

  /**
   * Returns the action that will be taken on entries that are evicted.
   */
  public String getAction() {
    return action;
  }

  @Override
  public String toString() {

    final StringBuilder buffer = new StringBuilder(128);
    buffer.append("EvictionAttributesData [");

    buffer.append("algorithm=").append(this.getAlgorithm());
    if (!this.getAlgorithm().equals(EvictionAlgorithm.NONE.toString())) {
      buffer.append(", action=").append(this.getAction());
      if (!this.getAlgorithm().equals(EvictionAlgorithm.LRU_HEAP.toString())) {
        buffer.append(", maximum=").append(this.getMaximum());
      }
    }
    buffer.append("]");
    return buffer.toString();
  }


}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy