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

com.gemstone.gemfire.admin.GemFireHealth 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.admin;

import com.gemstone.gemfire.internal.Assert;
import com.gemstone.gemfire.internal.i18n.LocalizedStrings;

/**
 * Provides information about the aggregate health of the members of a
 * GemFire distributed system ("components").  The {@link #getHealth
 * getHealth} method provides an indication of the overall health.
 * Health is expressed as one of three levels: {@link #GOOD_HEALTH
 * GOOD_HEALTH}, {@link #OKAY_HEALTH OKAY_HEALTH}, and {@link
 * #POOR_HEALTH POOR_HEALTH}.  The {@link #getDiagnosis getDiagnosis}
 * method provides a more detailed explanation of the cause of ill
 * health.
 *
 * 

* * The aggregate health of the GemFire component is evaluated * {@linkplain GemFireHealthConfig#setHealthEvaluationInterval every * so often} and if certain criteria are met, then the overall health * of the component changes accordingly. If any of the components is * in OKAY_HEALTH, then the overall health is * OKAY_HEALTH. If any of the components is in * POOR_HEALTH, then the overall health is * POOR_HEALTH. * * @author David Whitlock * * @since 3.5 * @deprecated as of 7.0 use the {@link com.gemstone.gemfire.management} package instead * */ public interface GemFireHealth { /** An indicator that the GemFire components are healthy. * * @see #getHealth */ public static final Health GOOD_HEALTH = new Health(Health.GOOD_STRING); /** An indicator that one or more GemFire components is slightly * unhealthy. The problem may or may not require configuration * changes and may not necessarily lead to poorer component health. * * @see #getHealth */ public static final Health OKAY_HEALTH = new Health(Health.OKAY_STRING); /** An indicator that one or more GemFire components is unhealthy. * While it may be possible for the components to recover on their * own, it is likely that they will have to be restarted. * * @see #getHealth */ public static final Health POOR_HEALTH = new Health(Health.POOR_STRING); /////////////////////// Instance Methods /////////////////////// /** * Returns an indicator of the overall health of the GemFire * components. * * @see #GOOD_HEALTH * @see #OKAY_HEALTH * @see #POOR_HEALTH */ public Health getHealth(); /** * Resets the overall health of the GemFire components to {@link * #GOOD_HEALTH}. This operation should be invoked when the * operator has determined that warnings about the components's * health do not need to be regarded. */ public void resetHealth(); /** * Returns a message that provides a description of the cause of a * component's ill health. */ public String getDiagnosis(); /** * Returns the configuration for determining the health of the * distributed system itself. */ public DistributedSystemHealthConfig getDistributedSystemHealthConfig(); /** * Sets the configuration for determining the health of the * distributed system itself. */ public void setDistributedSystemHealthConfig(DistributedSystemHealthConfig config); /** * Returns the GemFireHealthConfig for GemFire * components whose configurations are not overridden on a per-host * basis. Note that changes made to the returned * GemFireHealthConfig will not take effect until * {@link #setDefaultGemFireHealthConfig} is invoked. */ public GemFireHealthConfig getDefaultGemFireHealthConfig(); /** * Sets the GemFireHealthConfig for * GemFire components whose configurations are not overridden on a * per-host basis. * * @throws IllegalArgumentException * If config specifies the config for a host */ public void setDefaultGemFireHealthConfig(GemFireHealthConfig config); /** * Returns the GemFireHealthConfig for GemFire * components that reside on a given host. This configuration will * override the {@linkplain #getDefaultGemFireHealthConfig default} * configuration. * * @param hostName * The {@linkplain java.net.InetAddress#getCanonicalHostName * canonical} name of the host. */ public GemFireHealthConfig getGemFireHealthConfig(String hostName); /** * Sets the GemFireHealthConfig for GemFire * components that reside on a given host. This configuration will * override the {@linkplain #getDefaultGemFireHealthConfig default} * configuration. Note that changes made to the returned * GemFireHealthConfig will not take effect until * {@link #setDefaultGemFireHealthConfig} is invoked. * * @param hostName * The {@linkplain java.net.InetAddress#getCanonicalHostName * canonical} name of the host. * * @throws IllegalArgumentException * If host hostName does not exist or if there * are no GemFire components running on that host or if * config does not configure host * hostName. */ public void setGemFireHealthConfig(String hostName, GemFireHealthConfig config); /** * Closes this health monitor and releases all resources associated * with it. */ public void close(); /** * Returns whether or not this GemFireHealth is * {@linkplain #close closed}. */ public boolean isClosed(); ////////////////////// Inner Classes ////////////////////// /** * An enumerated type for the health of GemFire. */ public static class Health implements java.io.Serializable { private static final long serialVersionUID = 3039539430412151801L; /** The string for good health */ static final String GOOD_STRING = LocalizedStrings.GemFireHealth_GOOD.toLocalizedString(); /** The string for okay health */ static final String OKAY_STRING = LocalizedStrings.GemFireHealth_OKAY.toLocalizedString(); /** The string for poor health */ static final String POOR_STRING = LocalizedStrings.GemFireHealth_POOR.toLocalizedString(); //////////////////// Instance Fields //////////////////// /** The string for this health */ private String healthString; ///////////////////// Constructors ////////////////////// /** * Creates a new Health with the given string */ protected Health(String healthString) { this.healthString = healthString; } //////////////////// Instance Methods //////////////////// /** * Returns the appropriate canonical instance of * Health. */ public Object readResolve() { if (this.healthString.equals(GOOD_STRING)) { return GemFireHealth.GOOD_HEALTH; } else if (this.healthString.equals(OKAY_STRING)) { return GemFireHealth.OKAY_HEALTH; } else if (this.healthString.equals(POOR_STRING)) { return GemFireHealth.POOR_HEALTH; } else { Assert.assertTrue(false, "Unknown healthString: " + this.healthString); return null; } } @Override public String toString() { return this.healthString; } } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy