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

com.gemstone.gemfire.internal.DummyStatisticsImpl 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.internal;

import com.gemstone.gemfire.*;

/**
 * An implementation of {@link Statistics} that does nothing.
 * Setting the "gemfire.statsDisabled" to true causes it to be used.
 *
 * @see Package introduction
 *
 * @author Darrel Schneider
 *
 * @since 3.0
 *
 */
public class DummyStatisticsImpl implements Statistics {
  
  private final StatisticsType type;
  private final String textId;
  private final long numericId;

  ///////////////////////  Constructors  ///////////////////////

  /**
   * Creates a new statistics instance of the given type
   *
   * @param type
   *        A description of the statistics
   */
  public DummyStatisticsImpl(StatisticsType type, String textId, long numericId) {
    this.type = type;
    this.textId = textId;
    this.numericId = numericId;
  }

  public final void close() {
  }

  ////////////////////////  accessor Methods  ///////////////////////

  public final int nameToId(String name) {
    return this.type.nameToId(name);
  }

  public final StatisticDescriptor nameToDescriptor(String name) {
    return this.type.nameToDescriptor(name);
  }

  public final long getUniqueId() {
    return 0;
  }

  public final StatisticsType getType() {
    return this.type;
  }

  public final String getTextId() {
    return this.textId;
  }
  public final long getNumericId() {
    return this.numericId;
  }
  public final boolean isAtomic() {
    return true;
  }
  public final boolean isClosed() {
    return false;
  }
  
  ////////////////////////  set() Methods  ///////////////////////

  public final void setInt(int id, int value) {
  }

  public final void setInt(StatisticDescriptor descriptor, int value) {
  }

  public final void setInt(String name, int value) {
  }

  public final void setLong(int id, long value) {
  }

  public final void setLong(StatisticDescriptor descriptor, long value) {
  }

  public final void setLong(String name, long value) {
  }

  public final void setDouble(int id, double value) {
  }

  public final void setDouble(StatisticDescriptor descriptor, double value) {
  }

  public final void setDouble(String name, double value) {
  }

  ///////////////////////  get() Methods  ///////////////////////

  public final int getInt(int id) {
    return 0;
  }

  public final int getInt(StatisticDescriptor descriptor) {
    return 0;
  }

  public final int getInt(String name) {
    return 0;
  }

  public final long getLong(int id) {
    return 0;
  }

  public final long getLong(StatisticDescriptor descriptor) {
    return 0;
  }

  public final long getLong(String name) {
    return 0;
  }

  public final double getDouble(int id) {
    return 0.0;
  }

  public final double getDouble(StatisticDescriptor descriptor) {
    return 0.0;
  }

  public final double getDouble(String name) {
    return 0.0;
  }

  private static final Number dummyNumber = Integer.valueOf(0);

  public final Number get(StatisticDescriptor descriptor) {
    return dummyNumber; 
  }

  public final Number get(String name) {
    return dummyNumber; 
  }

  public final long getRawBits(StatisticDescriptor descriptor) {
    return 0;
  }

  public final long getRawBits(String name) {
    return 0;
  }

  ////////////////////////  inc() Methods  ////////////////////////

  public final void incInt(int id, int delta) {
  }

  public final void incInt(StatisticDescriptor descriptor, int delta) {
  }

  public final void incInt(String name, int delta) {
  }

  public final void incLong(int id, long delta) {
  }

  public final void incLong(StatisticDescriptor descriptor, long delta) {
  }

  public final void incLong(String name, long delta) {
  }

  public final void incDouble(int id, double delta) {
  }

  public final void incDouble(StatisticDescriptor descriptor, double delta) {
  }

  public final void incDouble(String name, double delta) {
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy