You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by ab...@apache.org on 2016/02/17 19:23:27 UTC
[23/51] [partial] incubator-geode git commit: GEODE-917: rename
gemfire subprojects to geode
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f6c4c2f9/gemfire-core/src/main/java/com/gemstone/gemfire/Statistics.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/Statistics.java b/gemfire-core/src/main/java/com/gemstone/gemfire/Statistics.java
deleted file mode 100644
index 97a679c..0000000
--- a/gemfire-core/src/main/java/com/gemstone/gemfire/Statistics.java
+++ /dev/null
@@ -1,446 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.
- */
-package com.gemstone.gemfire;
-
-//import com.gemstone.gemfire.distributed.DistributedSystem;
-
-/**
- * Instances of this interface maintain the values of various application-defined
- * statistics. The statistics themselves are described by an instance
- * of {@link StatisticsType}.
- *
- * <P>
- * To get an instance of this interface use an instance of
- * {@link StatisticsFactory}.
- * <P>
- *
- * For improved performance, each statistic may be referred to by
- * its {@link #nameToDescriptor descriptor}.
- * <P>
- * For optimal performance, each statistic may be referred to by
- * its {@link #nameToId id} in the statistics object. Note that
- * ids can not be mapped back to their name and methods that take ids
- * are unsafe. It is important to call the correct type of method
- * for the given id. For example if your stat is a long then incLong
- * must be called instead of incInt.
- * <p>Note that as of the 5.1 release the <code>incInt</code>,
- * <code>incLong</code>, and <code>incDouble</code> methods no longer
- * return the new value of the statistic. They now return <code>void</code>.
- * This incompatible change was made
- * to allow for a more efficient concurrent increment implementation.
- * <P>
- *
- * @see <A href="package-summary.html#statistics">Package introduction</A>
- *
- * @author David Whitlock
- * @author Darrel Schneider
- *
- * @since 3.0
- *
- */
-public interface Statistics {
-
- /**
- * Closes these statistics. After statistics have been closed, they
- * are no longer archived.
- * A value access on a closed statistics always results in zero.
- * A value modification on a closed statistics is ignored.
- */
- public void close();
-
- //////////////////////// accessor Methods ///////////////////////
-
- /**
- * Returns the id of the statistic with the given name in this
- * statistics instance.
- *
- * @throws IllegalArgumentException
- * No statistic named <code>name</code> exists in this
- * statistics instance.
- *
- * @see StatisticsType#nameToId
- */
- public int nameToId(String name);
-
-
- /**
- * Returns the descriptor of the statistic with the given name in this
- * statistics instance.
- *
- * @throws IllegalArgumentException
- * No statistic named <code>name</code> exists in this
- * statistics instance.
- *
- * @see StatisticsType#nameToDescriptor
- */
- public StatisticDescriptor nameToDescriptor(String name);
-
- /**
- * Gets a value that uniquely identifies this statistics.
- */
- public long getUniqueId();
-
- /**
- * Gets the {@link StatisticsType} of this instance.
- */
- public StatisticsType getType();
- /**
- * Gets the text associated with this instance that helps identify it.
- */
- public String getTextId();
- /**
- * Gets the number associated with this instance that helps identify it.
- */
- public long getNumericId();
- /**
- * Returns true if modifications are atomic. This means that multiple threads,
- * can safely modify this instance without extra synchronization.
- * <p>
- * Returns false if modifications are not atomic. This means that modifications
- * to this instance are cheaper but not thread safe.
- */
- public boolean isAtomic();
- /**
- * Returns true if the instance has been {@link #close closed}.
- */
- public boolean isClosed();
-
- //////////////////////// set() Methods ///////////////////////
-
- /**
- * Sets the value of a statistic with the given <code>id</code>
- * whose type is <code>int</code>.
- * @param id a statistic id obtained with {@link #nameToId}
- * or {@link StatisticsType#nameToId}.
- *
- * @throws ArrayIndexOutOfBoundsException
- * If the id is invalid.
- */
- public void setInt(int id, int value);
-
- /**
- * Sets the value of a named statistic of type <code>int</code>
- *
- * @throws IllegalArgumentException
- * If no statistic exists named <code>name</code> or
- * if the statistic with name <code>name</code> is not of
- * type <code>int</code>.
- */
- public void setInt(String name, int value);
-
- /**
- * Sets the value of a described statistic of type <code>int</code>
- *
- * @throws IllegalArgumentException
- * If no statistic exists for the given <code>descriptor</code> or
- * if the described statistic is not of
- * type <code>int</code>.
- */
- public void setInt(StatisticDescriptor descriptor, int value);
-
- /**
- * Sets the value of a statistic with the given <code>id</code>
- * whose type is <code>long</code>.
- * @param id a statistic id obtained with {@link #nameToId}
- * or {@link StatisticsType#nameToId}.
- *
- * @throws ArrayIndexOutOfBoundsException
- * If the id is invalid.
- */
- public void setLong(int id, long value);
-
- /**
- * Sets the value of a described statistic of type <code>long</code>
- *
- * @throws IllegalArgumentException
- * If no statistic exists for the given <code>descriptor</code> or
- * if the described statistic is not of
- * type <code>long</code>.
- */
- public void setLong(StatisticDescriptor descriptor, long value);
-
- /**
- * Sets the value of a named statistic of type <code>long</code>.
- *
- * @throws IllegalArgumentException
- * If no statistic exists named <code>name</code> or
- * if the statistic with name <code>name</code> is not of
- * type <code>long</code>.
- */
- public void setLong(String name, long value);
-
- /**
- * Sets the value of a statistic with the given <code>id</code>
- * whose type is <code>double</code>.
- * @param id a statistic id obtained with {@link #nameToId}
- * or {@link StatisticsType#nameToId}.
- *
- * @throws ArrayIndexOutOfBoundsException
- * If the id is invalid.
- */
- public void setDouble(int id, double value);
-
- /**
- * Sets the value of a described statistic of type <code>double</code>
- *
- * @throws IllegalArgumentException
- * If no statistic exists for the given <code>descriptor</code> or
- * if the described statistic is not of
- * type <code>double</code>.
- */
- public void setDouble(StatisticDescriptor descriptor, double value);
- /**
- * Sets the value of a named statistic of type <code>double</code>.
- *
- * @throws IllegalArgumentException
- * If no statistic exists named <code>name</code> or
- * if the statistic with name <code>name</code> is not of
- * type <code>double</code>.
- */
- public void setDouble(String name, double value);
-
- /////////////////////// get() Methods ///////////////////////
-
- /**
- * Returns the value of the identified statistic of type <code>int</code>.
- *
- * @param id a statistic id obtained with {@link #nameToId}
- * or {@link StatisticsType#nameToId}.
- * @throws ArrayIndexOutOfBoundsException
- * If the id is invalid.
- */
- public int getInt(int id);
-
- /**
- * Returns the value of the described statistic of type <code>int</code>.
- *
- * @throws IllegalArgumentException
- * If no statistic exists with the specified <code>descriptor</code> or
- * if the described statistic is not of
- * type <code>int</code>.
- */
- public int getInt(StatisticDescriptor descriptor);
- /**
- * Returns the value of the statistic of type <code>int</code> at
- * the given name.
- *
- * @throws IllegalArgumentException
- * If no statistic exists with name <code>name</code> or
- * if the statistic named <code>name</code> is not of
- * type <code>int</code>.
- */
- public int getInt(String name);
-
- /**
- * Returns the value of the identified statistic of type <code>long</code>.
- *
- * @param id a statistic id obtained with {@link #nameToId}
- * or {@link StatisticsType#nameToId}.
- * @throws ArrayIndexOutOfBoundsException
- * If the id is invalid.
- */
- public long getLong(int id);
-
-
- /**
- * Returns the value of the described statistic of type <code>long</code>.
- *
- * @throws IllegalArgumentException
- * If no statistic exists with the specified <code>descriptor</code> or
- * if the described statistic is not of
- * type <code>long</code>.
- */
- public long getLong(StatisticDescriptor descriptor);
- /**
- * Returns the value of the statistic of type <code>long</code> at
- * the given name.
- *
- * @throws IllegalArgumentException
- * If no statistic exists with name <code>name</code> or
- * if the statistic named <code>name</code> is not of
- * type <code>long</code>.
- */
- public long getLong(String name);
-
- /**
- * Returns the value of the identified statistic of type <code>double</code>.
- *
- * @param id a statistic id obtained with {@link #nameToId}
- * or {@link StatisticsType#nameToId}.
- * @throws ArrayIndexOutOfBoundsException
- * If the id is invalid.
- */
- public double getDouble(int id);
-
- /**
- * Returns the value of the described statistic of type <code>double</code>.
- *
- * @throws IllegalArgumentException
- * If no statistic exists with the specified <code>descriptor</code> or
- * if the described statistic is not of
- * type <code>double</code>.
- */
- public double getDouble(StatisticDescriptor descriptor);
- /**
- * Returns the value of the statistic of type <code>double</code> at
- * the given name.
- *
- * @throws IllegalArgumentException
- * If no statistic exists with name <code>name</code> or
- * if the statistic named <code>name</code> is not of
- * type <code>double</code>.
- */
- public double getDouble(String name);
-
- /**
- * Returns the value of the identified statistic.
- *
- * @param descriptor a statistic descriptor obtained with {@link #nameToDescriptor}
- * or {@link StatisticsType#nameToDescriptor}.
- * @throws IllegalArgumentException
- * If the described statistic does not exist
- */
- public Number get(StatisticDescriptor descriptor);
-
- /**
- * Returns the value of the named statistic.
- *
- * @throws IllegalArgumentException
- * If the named statistic does not exist
- */
- public Number get(String name);
-
- /**
- * Returns the bits that represent the raw value of the described statistic.
- *
- * @param descriptor a statistic descriptor obtained with {@link #nameToDescriptor}
- * or {@link StatisticsType#nameToDescriptor}.
- * @throws IllegalArgumentException
- * If the described statistic does not exist
- */
- public long getRawBits(StatisticDescriptor descriptor);
-
- /**
- * Returns the bits that represent the raw value of the named statistic.
- *
- * @throws IllegalArgumentException
- * If the named statistic does not exist
- */
- public long getRawBits(String name);
-
- //////////////////////// inc() Methods ////////////////////////
-
- /**
- * Increments the value of the identified statistic of type <code>int</code>
- * by the given amount.
- *
- * @param id a statistic id obtained with {@link #nameToId}
- * or {@link StatisticsType#nameToId}.
- *
- * @throws ArrayIndexOutOfBoundsException
- * If the id is invalid.
- */
- public void incInt(int id, int delta);
-
- /**
- * Increments the value of the described statistic of type <code>int</code>
- * by the given amount.
- *
- * @throws IllegalArgumentException
- * If no statistic exists with the given <code>descriptor</code> or
- * if the described statistic is not of
- * type <code>int</code>.
- */
- public void incInt(StatisticDescriptor descriptor, int delta);
-
- /**
- * Increments the value of the statistic of type <code>int</code> with
- * the given name by a given amount.
- *
- * @throws IllegalArgumentException
- * If no statistic exists with name <code>name</code> or
- * if the statistic named <code>name</code> is not of
- * type <code>int</code>.
- */
- public void incInt(String name, int delta);
-
- /**
- * Increments the value of the identified statistic of type <code>long</code>
- * by the given amount.
- *
- * @param id a statistic id obtained with {@link #nameToId}
- * or {@link StatisticsType#nameToId}.
- *
- * @throws ArrayIndexOutOfBoundsException
- * If the id is invalid.
- */
- public void incLong(int id, long delta);
-
- /**
- * Increments the value of the described statistic of type <code>long</code>
- * by the given amount.
- *
- * @throws IllegalArgumentException
- * If no statistic exists with the given <code>descriptor</code> or
- * if the described statistic is not of
- * type <code>long</code>.
- */
- public void incLong(StatisticDescriptor descriptor, long delta);
- /**
- * Increments the value of the statistic of type <code>long</code> with
- * the given name by a given amount.
- *
- * @throws IllegalArgumentException
- * If no statistic exists with name <code>name</code> or
- * if the statistic named <code>name</code> is not of
- * type <code>long</code>.
- */
- public void incLong(String name, long delta);
-
- /**
- * Increments the value of the identified statistic of type <code>double</code>
- * by the given amount.
- *
- * @param id a statistic id obtained with {@link #nameToId}
- * or {@link StatisticsType#nameToId}.
- *
- * @throws ArrayIndexOutOfBoundsException
- * If the id is invalid.
- */
- public void incDouble(int id, double delta);
-
- /**
- * Increments the value of the described statistic of type <code>double</code>
- * by the given amount.
- *
- * @throws IllegalArgumentException
- * If no statistic exists with the given <code>descriptor</code> or
- * if the described statistic is not of
- * type <code>double</code>.
- */
- public void incDouble(StatisticDescriptor descriptor, double delta);
- /**
- * Increments the value of the statistic of type <code>double</code> with
- * the given name by a given amount.
- *
- * @throws IllegalArgumentException
- * If no statistic exists with name <code>name</code> or
- * if the statistic named <code>name</code> is not of
- * type <code>double</code>.
- */
- public void incDouble(String name, double delta);
-}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f6c4c2f9/gemfire-core/src/main/java/com/gemstone/gemfire/StatisticsFactory.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/StatisticsFactory.java b/gemfire-core/src/main/java/com/gemstone/gemfire/StatisticsFactory.java
deleted file mode 100644
index 57b5a11..0000000
--- a/gemfire-core/src/main/java/com/gemstone/gemfire/StatisticsFactory.java
+++ /dev/null
@@ -1,154 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.
- */
-package com.gemstone.gemfire;
-
-//import com.gemstone.gemfire.distributed.DistributedSystem;
-//import com.gemstone.gemfire.internal.StatArchiveFormat;
-//import java.io.IOException;
-//import java.io.Reader;
-
-/**
- * Instances of this interface provide methods that create instances
- * of {@link Statistics}.
- * It can also be used to create instances of {@link StatisticDescriptor}
- * and {@link StatisticsType} because it implements {@link StatisticsTypeFactory}.
- * {@link
- * com.gemstone.gemfire.distributed.DistributedSystem} is the only
- * instance of this interface.
- *
- * <P>
- *
- * A <code>StatisticsFactory</code> can create a {@link
- * StatisticDescriptor statistic} of three numeric types:
- * <code>int</code>, <code>long</code>, and <code>double</code>. A
- * statistic (<code>StatisticDescriptor</code>) can either be a
- * <I>gauge</I> meaning that its value can increase and decrease or a
- * <I>counter</I> meaning that its value is strictly increasing.
- * Marking a statistic as a counter allows statistic display tools
- * to properly display a statistics whose value "wraps around" (that
- * is, exceeds its maximum value).
- *
- * <P>The following code is an example of how to create a type using the api.
- * In this example the type has two stats whose values always increase:
- * <pre>
- StatisticsFactory f = ...;
- StatisticsType t = f.createType(
- "StatSampler",
- "Stats on the statistic sampler.",
- new StatisticDescriptor[] {
- f.createIntCounter("sampleCount",
- "Total number of samples taken by this sampler.",
- "samples"),
- f.createLongCounter("sampleTime",
- "Total amount of time spent taking samples.",
- "milliseconds"),
- }
- );
- this.samplerStats = f.createStatistics(t, "statSampler");
- this.sampleCountId = this.samplerStats.nameToId("sampleCount");
- this.sampleTimeId = this.samplerStats.nameToId("sampleTime");
- * </pre>
- * Later on the stat ids can be used to increment the stats:
- * <pre>
- this.samplerStats.incInt(this.sampleCountId, 1);
- this.samplerStats.incLong(this.sampleTimeId, nanosSpentWorking / 1000000);
- * </pre>
- * <P>The following is an example of how to create the same type using XML.
- * The XML data:
- * <pre>
- <?xml version="1.0" encoding="UTF-8"?>
- <!DOCTYPE statistics PUBLIC
- "-//GemStone Systems, Inc.//GemFire Statistics Type//EN"
- "http://www.gemstone.com/dtd/statisticsType.dtd">
- <statistics>
- <type name="StatSampler">
- <description>Stats on the statistic sampler.</description>
- <stat name="sampleCount" storage="int" counter="true">
- <description>Total number of samples taken by this sampler.</description>
- <unit>samples</unit>
- </stat>
- <stat name="sampleTime" storage="long" counter="true">
- <description>Total amount of time spent taking samples.</description>
- <unit>milliseconds</unit>
- </stat>
- </type>
- </statistics>
- * </pre>
- * The code to create the type:
- * <pre>
- StatisticsFactory f = ...;
- Reader r = new InputStreamReader("fileContainingXmlData"));
- StatisticsType type = f.createTypesFromXml(r)[0];
- * </pre>
- * <P>
- * @see <A href="package-summary.html#statistics">Package introduction</A>
- *
- * @author Darrel Schneider
- *
- * @since 3.0
- */
-public interface StatisticsFactory extends StatisticsTypeFactory {
- /**
- * Creates and returns a {@link Statistics} instance of the given {@link StatisticsType type} with default ids.
- * <p>
- * The created instance may not be {@link Statistics#isAtomic atomic}.
- */
- public Statistics createStatistics(StatisticsType type);
- /**
- * Creates and returns a {@link Statistics} instance of the given {@link StatisticsType type}, <code>textId</code>, and with a default numeric id.
- * <p>
- * The created instance may not be {@link Statistics#isAtomic atomic}.
- */
- public Statistics createStatistics(StatisticsType type, String textId);
- /**
- * Creates and returns a {@link Statistics} instance of the given {@link StatisticsType type}, <code>textId</code>, and <code>numericId</code>.
- * <p>
- * The created instance may not be {@link Statistics#isAtomic atomic}.
- */
- public Statistics createStatistics(StatisticsType type, String textId, long numericId);
-
- /**
- * Creates and returns a {@link Statistics} instance of the given {@link StatisticsType type} with default ids.
- * <p>
- * The created instance will be {@link Statistics#isAtomic atomic}.
- */
- public Statistics createAtomicStatistics(StatisticsType type);
- /**
- * Creates and returns a {@link Statistics} instance of the given {@link StatisticsType type}, <code>textId</code>, and with a default numeric id.
- * <p>
- * The created instance will be {@link Statistics#isAtomic atomic}.
- */
- public Statistics createAtomicStatistics(StatisticsType type, String textId);
- /**
- * Creates and returns a {@link Statistics} instance of the given {@link StatisticsType type}, <code>textId</code>, and <code>numericId</code>.
- * <p>
- * The created instance will be {@link Statistics#isAtomic atomic}.
- */
- public Statistics createAtomicStatistics(StatisticsType type, String textId, long numericId);
- /**
- * Returns an array of all the existing statistics of the given type.
- */
- public Statistics[] findStatisticsByType(StatisticsType type);
- /**
- * Returns an array of all the existing statistics with the given textId.
- */
- public Statistics[] findStatisticsByTextId(String textId);
- /**
- * Returns an array of all the existing statistics with the given numericId.
- */
- public Statistics[] findStatisticsByNumericId(long numericId);
-}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f6c4c2f9/gemfire-core/src/main/java/com/gemstone/gemfire/StatisticsType.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/StatisticsType.java b/gemfire-core/src/main/java/com/gemstone/gemfire/StatisticsType.java
deleted file mode 100644
index a372e14..0000000
--- a/gemfire-core/src/main/java/com/gemstone/gemfire/StatisticsType.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.
- */
-package com.gemstone.gemfire;
-
-//import com.gemstone.gemfire.internal.Assert;
-//import java.io.*;
-//import java.util.*;
-
-/**
- * Used to describe a logical collection of statistics. These descriptions
- * are used to create an instance of {@link Statistics}.
- *
- * <P>
- * To get an instance of this interface use an instance of
- * {@link StatisticsFactory}.
- *
- * @author Darrel Schneider
- *
- * @since 3.0
- */
-public interface StatisticsType {
-
- /**
- * Returns the name of this statistics type
- */
- public String getName();
-
- /**
- * Returns a description of this statistics type
- */
- public String getDescription();
-
- /**
- * Returns descriptions of the statistics that this statistics type
- * gathers together
- */
- public StatisticDescriptor[] getStatistics();
-
- /**
- * Returns the id of the statistic with the given name in this
- * statistics instance.
- *
- * @throws IllegalArgumentException
- * No statistic named <code>name</code> exists in this
- * statistics instance.
- */
- public int nameToId(String name);
- /**
- * Returns the descriptor of the statistic with the given name in this
- * statistics instance.
- *
- * @throws IllegalArgumentException
- * No statistic named <code>name</code> exists in this
- * statistics instance.
- */
- public StatisticDescriptor nameToDescriptor(String name);
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f6c4c2f9/gemfire-core/src/main/java/com/gemstone/gemfire/StatisticsTypeFactory.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/StatisticsTypeFactory.java b/gemfire-core/src/main/java/com/gemstone/gemfire/StatisticsTypeFactory.java
deleted file mode 100644
index fabe9b1..0000000
--- a/gemfire-core/src/main/java/com/gemstone/gemfire/StatisticsTypeFactory.java
+++ /dev/null
@@ -1,197 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.
- */
-package com.gemstone.gemfire;
-
-//import com.gemstone.gemfire.distributed.DistributedSystem;
-import com.gemstone.gemfire.internal.StatArchiveFormat;
-import java.io.IOException;
-import java.io.Reader;
-
-/**
- * Instances of this interface provide methods that create instances
- * of {@link StatisticDescriptor} and {@link StatisticsType}.
- * Every {@link StatisticsFactory} is also a type factory.
- *
- * <P>
- *
- * A <code>StatisticsTypeFactory</code> can create a {@link
- * StatisticDescriptor statistic} of three numeric types:
- * <code>int</code>, <code>long</code>, and <code>double</code>. A
- * statistic (<code>StatisticDescriptor</code>) can either be a
- * <I>gauge</I> meaning that its value can increase and decrease or a
- * <I>counter</I> meaning that its value is strictly increasing.
- * Marking a statistic as a counter allows statistic display tools
- * to properly display a statistics whose value "wraps around" (that
- * is, exceeds its maximum value).
- *
- * <P>The following code is an example of how to create a type using XML.
- * In this example the type has two stats whose values always increase:
- * <pre>
- StatisticsTypeFactory f = ...;
- StatisticsType t = f.createType(
- "StatSampler",
- "Stats on the statistic sampler.",
- new StatisticDescriptor[] {
- f.createIntCounter("sampleCount",
- "Total number of samples taken by this sampler.",
- "samples"),
- f.createLongCounter("sampleTime",
- "Total amount of time spent taking samples.",
- "milliseconds"),
- }
- );
- * </pre>
- * <P>The following is an example of how to create the same type using XML.
- * The XML data:
- * <pre>
- <?xml version="1.0" encoding="UTF-8"?>
- <!DOCTYPE statistics PUBLIC
- "-//GemStone Systems, Inc.//GemFire Statistics Type//EN"
- "http://www.gemstone.com/dtd/statisticsType.dtd">
- <statistics>
- <type name="StatSampler">
- <description>Stats on the statistic sampler.</description>
- <stat name="sampleCount" storage="int" counter="true">
- <description>Total number of samples taken by this sampler.</description>
- <unit>samples</unit>
- </stat>
- <stat name="sampleTime" storage="long" counter="true">
- <description>Total amount of time spent taking samples.</description>
- <unit>milliseconds</unit>
- </stat>
- </type>
- </statistics>
- * </pre>
- * The code to create the type:
- * <pre>
- StatisticsTypeFactory f = ...;
- Reader r = new InputStreamReader("fileContainingXmlData"));
- StatisticsType type = f.createTypesFromXml(r)[0];
- * </pre>
- * <P>
- * @see <A href="package-summary.html#statistics">Package introduction</A>
- *
- * @author Darrel Schneider
- *
- * @since 3.0
- */
-public interface StatisticsTypeFactory {
-
- /**
- * Creates and returns an int counter {@link StatisticDescriptor} with the given <code>name</code>, <code>description</code>, <code>units</code>,
- * and with larger values indicating better performance.
- */
- public StatisticDescriptor createIntCounter(String name, String description,
- String units);
- /**
- * Creates and returns a long counter {@link StatisticDescriptor} with the given <code>name</code>, <code>description</code>, <code>units</code>,
- * and with larger values indicating better performance.
- */
- public StatisticDescriptor createLongCounter(String name, String description,
- String units);
- /**
- * Creates and returns a double counter {@link StatisticDescriptor} with the given <code>name</code>, <code>description</code>, <code>units</code>,
- * and with larger values indicating better performance.
- */
- public StatisticDescriptor createDoubleCounter(String name, String description,
- String units);
- /**
- * Creates and returns an int gauge {@link StatisticDescriptor} with the given <code>name</code>, <code>description</code>, <code>units</code>,
- * and with smaller values indicating better performance.
- */
- public StatisticDescriptor createIntGauge(String name, String description,
- String units);
- /**
- * Creates and returns a long gauge {@link StatisticDescriptor} with the given <code>name</code>, <code>description</code>, <code>units</code>,
- * and with smaller values indicating better performance.
- */
- public StatisticDescriptor createLongGauge(String name, String description,
- String units);
- /**
- * Creates and returns a double gauge {@link StatisticDescriptor} with the given <code>name</code>, <code>description</code>, <code>units</code>,
- * and with smaller values indicating better performance.
- */
- public StatisticDescriptor createDoubleGauge(String name, String description,
- String units);
-
- /**
- * Creates and returns an int counter {@link StatisticDescriptor} with the given <code>name</code>, <code>description</code>, <code>largerBetter</code>, and <code>units</code>.
- */
- public StatisticDescriptor createIntCounter(String name, String description,
- String units, boolean largerBetter);
- /**
- * Creates and returns a long counter {@link StatisticDescriptor} with the given <code>name</code>, <code>description</code>, <code>largerBetter</code>, and <code>units</code>.
- */
- public StatisticDescriptor createLongCounter(String name, String description,
- String units, boolean largerBetter);
- /**
- * Creates and returns a double counter {@link StatisticDescriptor} with the given <code>name</code>, <code>description</code>, <code>largerBetter</code>, and <code>units</code>.
- */
- public StatisticDescriptor createDoubleCounter(String name, String description,
- String units, boolean largerBetter);
- /**
- * Creates and returns an int gauge {@link StatisticDescriptor} with the given <code>name</code>, <code>description</code>, <code>largerBetter</code>, and <code>units</code>.
- */
- public StatisticDescriptor createIntGauge(String name, String description,
- String units, boolean largerBetter);
- /**
- * Creates and returns a long gauge {@link StatisticDescriptor} with the given <code>name</code>, <code>description</code>, <code>largerBetter</code>, and <code>units</code>.
- */
- public StatisticDescriptor createLongGauge(String name, String description,
- String units, boolean largerBetter);
- /**
- * Creates and returns a double gauge {@link StatisticDescriptor} with the given <code>name</code>, <code>description</code>, <code>largerBetter</code>, and <code>units</code>.
- */
- public StatisticDescriptor createDoubleGauge(String name, String description,
- String units, boolean largerBetter);
-
-
- /**
- * The maximum number of descriptors a single statistics type can have.
- * <P> Current value is: <code>254</code>
- */
- public final int MAX_DESCRIPTORS_PER_TYPE = StatArchiveFormat.ILLEGAL_STAT_OFFSET-1;
-
- /**
- * Creates or finds and returns a {@link StatisticsType} with the given <code>name</code>, <code>description</code>, and {@link StatisticDescriptor statistic descriptions}.
- * @throws IllegalArgumentException if a type with the given <code>name</code> already exists and it differs from the given parameters.
- */
- public StatisticsType createType(String name, String description,
- StatisticDescriptor[] stats);
- /**
- * Finds and returns an already created {@link StatisticsType} with the given <code>name</code>. Returns <code>null</code> if the type does not exist.
- */
- public StatisticsType findType(String name);
-
- /**
- * Creates one or more {@link StatisticsType} from the contents of the
- * given <code>reader</code>. The created types can be found by calling
- * {@link #findType}.
- *
- * @param reader
- * The source of the XML data which must comply with the
- * <code>statisticsType.dtd</code>.
- *
- * @throws IllegalArgumentException if a type defined in the reader
- * already exists
- * @throws IOException
- * Something went wrong while reading from
- * <code>reader</code>
- */
- public StatisticsType[] createTypesFromXml(Reader reader)
- throws IOException;
-}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f6c4c2f9/gemfire-core/src/main/java/com/gemstone/gemfire/SystemConnectException.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/SystemConnectException.java b/gemfire-core/src/main/java/com/gemstone/gemfire/SystemConnectException.java
deleted file mode 100644
index 01636d3..0000000
--- a/gemfire-core/src/main/java/com/gemstone/gemfire/SystemConnectException.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.
- */
-package com.gemstone.gemfire;
-
-/**
- * An <code>SystemConnectException</code> is thrown when a
- * GemFire application tries to connect to an
- * existing distributed system and is unable to contact all members of
- * the distributed system to announce its presence. This is usually due
- * to resource depletion problems (low memory or too few file descriptors)
- * in other processes.
- */
-public class SystemConnectException extends GemFireException {
-private static final long serialVersionUID = -7378174428634468238L;
-
- ////////////////////// Constructors //////////////////////
-
- /**
- * Creates a new <code>SystemConnectException</code>.
- */
- public SystemConnectException(String message) {
- super(message);
- }
-
- public SystemConnectException(String message, Throwable cause) {
- super(message, cause);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f6c4c2f9/gemfire-core/src/main/java/com/gemstone/gemfire/SystemFailure.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/SystemFailure.java b/gemfire-core/src/main/java/com/gemstone/gemfire/SystemFailure.java
deleted file mode 100644
index 1775063..0000000
--- a/gemfire-core/src/main/java/com/gemstone/gemfire/SystemFailure.java
+++ /dev/null
@@ -1,1239 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.
- */
-/**
- *
- */
-package com.gemstone.gemfire;
-
-import com.gemstone.gemfire.internal.SystemFailureTestHook;
-import com.gemstone.gemfire.internal.admin.remote.RemoteGfManagerAgent;
-import com.gemstone.gemfire.internal.cache.GemFireCacheImpl;
-import com.gemstone.gemfire.internal.i18n.LocalizedStrings;
-
-/**
- * Catches and responds to JVM failure
- * <p>
- * This class represents a catastrophic failure of the system,
- * especially the Java virtual machine. Any class may,
- * at any time, indicate that a system failure has occurred by calling
- * {@link #initiateFailure(Error)} (or, less commonly,
- * {@link #setFailure(Error)}).
- * <p>
- * In practice, the most common type of failure that is likely to be
- * reported by an otherwise healthy JVM is {@link OutOfMemoryError}. However,
- * GemFire will report any occurrence of {@link VirtualMachineError} as
- * a JVM failure.
- * <p>
- * When a failure is reported, you must assume that the JVM has <em>broken
- * its fundamental execution contract</em> with your application.
- * No programming invariant can be assumed to be true, and your
- * entire application must be regarded as corrupted.
- * <h1>Failure Hooks</h1>
- * GemFire uses this class to disable its distributed system (group
- * communication) and any open caches. It also provides a hook for you
- * to respond to after GemFire disables itself.
- * <h1>Failure WatchDog</h1>
- * When {@link #startThreads()} is called, a "watchdog" {@link Thread} is started that
- * periodically checks to see if system corruption has been reported. When
- * system corruption is detected, this thread proceeds to:
- * <p>
- * <ol>
- * <li>
- * <em>Close GemFire</em> -- Group communication is ceased (this cache
- * member recuses itself from the distributed system) and the cache
- * is further poisoned (it is pointless to try to cleanly close it at this
- * point.).
- * <p>
- * After this has successfully ended, we launch a
- * </li>
- * <li>
- * <em>failure action</em>, a user-defined Runnable
- * {@link #setFailureAction(Runnable)}.
- * By default, this Runnable performs nothing. If you feel you need to perform
- * an action before exiting the JVM, this hook gives you a
- * means of attempting some action. Whatever you attempt should be extremely
- * simple, since your Java execution environment has been corrupted.
- * <p>
- * GemStone recommends that you employ
- * <a href="http://wrapper.tanukisoftware.org/doc/english/introduction.html">
- * Java Service Wrapper</a> to detect when your JVM exits and to perform
- * appropriate failure and restart actions.
- * </li>
- * <li>
- * Finally, if the application has granted the watchdog permission to exit the JVM
- * (via {@link #setExitOK(boolean)}), the watchdog calls {@link System#exit(int)} with
- * an argument of 1. If you have not granted this class permission to
- * close the JVM, you are <em>strongly</em> advised to call it in your
- * failure action (in the previous step).
- * </li>
- * </ol>
- * <p>
- * Each of these actions will be run exactly once in the above described
- * order. However, if either step throws any type of error ({@link Throwable}),
- * the watchdog will assume that the JVM is still under duress (esp. an
- * {@link OutOfMemoryError}), will wait a bit, and then retry the failed action.
- * <p>
- * It bears repeating that you should be very cautious of any Runnables you
- * ask this class to run. By definition the JVM is <em>very sick</em>
- * when failure has been signalled.
- * <p>
- * <h1>Failure Proctor</h1>
- * In addition to the failure watchdog, {@link #startThreads()} creates a second
- * thread (the "proctor") that monitors free memory. It does this by examining
- * {@link Runtime#freeMemory() free memory},
- * {@link Runtime#totalMemory() total memory} and
- * {@link Runtime#maxMemory() maximum memory}. If the amount of available
- * memory stays below a given
- * {@link #setFailureMemoryThreshold(long) threshold}, for
- * more than {@link #WATCHDOG_WAIT} seconds, the watchdog is notified.
- * <p>
- * Note that the proctor can be effectively disabled by
- * {@link SystemFailure#setFailureMemoryThreshold(long) setting} the failure memory threshold
- * to a negative value.
- * <p>
- * The proctor is a second line of defense, attempting to detect
- * OutOfMemoryError conditions in circumstances where nothing alerted the
- * watchdog. For instance, a third-party jar might incorrectly handle this
- * error and leave your virtual machine in a "stuck" state.
- * <p>
- * Note that the proctor does not relieve you of the obligation to
- * follow the best practices in the next section.
- * <h1>Best Practices</h1>
- * <h2>Catch and Handle VirtualMachineError</h2>
- * If you feel obliged to catch <em>either</em> {@link Error}, or
- * {@link Throwable}, you <em>must</em>also check for
- * {@link VirtualMachineError} like so:
- * <p>
- * <pre>
- catch (VirtualMachineError err) {
- SystemFailure.{@link #initiateFailure(Error) initiateFailure}(err);
- // If this ever returns, rethrow the error. We're poisoned
- // now, so don't let this thread continue.
- throw err;
- }
- * </pre>
- * <h2>Periodically Check For Errors</h2>
- * Check for serious system errors at
- * appropriate points in your algorithms. You may elect to use
- * the {@link #checkFailure()} utility function, but you are
- * not required to (you could just see if {@link SystemFailure#getFailure()}
- * returns a non-null result).
- * <p>
- * A job processing loop is a good candidate, for
- * instance, in com.gemstone.org.jgroups.protocols.UDP#run(),
- * which implements {@link Thread#run}:
- * <p>
- * <pre>
- for (;;) {
- SystemFailure.{@link #checkFailure() checkFailure}();
- if (mcast_recv_sock == null || mcast_recv_sock.isClosed()) break;
- if (Thread.currentThread().isInterrupted()) break;
- ...
- * </pre>
- * <h2>Create Logging ThreadGroups</h2>
- * If you create any Thread, a best practice is to catch severe errors
- * and signal failure appropriately. One trick to do this is to create a
- * ThreadGroup that handles uncaught exceptions by overriding
- * {@link ThreadGroup#uncaughtException(Thread, Throwable)} and to declare
- * your thread as a member of that {@link ThreadGroup}. This also has a
- * significant side-benefit in that most uncaught exceptions
- * can be detected:
- * <p>
- * <pre>
- ThreadGroup tg = new ThreadGroup("Worker Threads") {
- public void uncaughtException(Thread t, Throwable e) {
- // Do this *before* any object allocation in case of
- // OutOfMemoryError (for instance)
- if (e instanceof VirtualMachineError) {
- SystemFailure.{@link #setFailure(Error) setFailure}((VirtualMachineError)e); // don't throw
- }
- String s = "Uncaught exception in thread " + t;
- system.getLogWriter().severe(s, e);
- }
- Thread t = new Thread(myRunnable, tg, "My Thread");
- t.start();
- }; * </pre>
- * <p>
- * <h2>Catches of Error and Throwable Should Check for Failure</h2>
- * Keep in mind that peculiar or flat-out<em>impossible</em> exceptions may
- * ensue after a VirtualMachineError has been thrown <em>anywhere</em> in
- * your virtual machine. Whenever you catch {@link Error} or {@link Throwable},
- * you should also make sure that you aren't dealing with a corrupted JVM:
- * <p>
- * <pre>
- catch (Throwable t) {
- // Whenever you catch Error or Throwable, you must also
- // catch VirtualMachineError (see above). However, there is
- // _still_ a possibility that you are dealing with a cascading
- // error condition, so you also need to check to see if the JVM
- // is still usable:
- SystemFailure.{@link #checkFailure() checkFailure}();
- ...
- }
- * </pre>
- * @author jpenney
- * @since 5.1
- */
-@edu.umd.cs.findbugs.annotations.SuppressWarnings(value="DM_GC", justification="This class performs System.gc as last ditch effort during out-of-memory condition.")
-public final class SystemFailure {
-
- /**
- * Time to wait during stopWatchdog and stopProctor. Not final
- * for tests
- */
- static int SHUTDOWN_WAIT = 1000;
- /**
- * Preallocated error messages\
- * LocalizedStrings may use memory (in the form of an iterator)
- * so we must get the translated messages in advance.
- **/
- static final String JVM_CORRUPTION = LocalizedStrings.SystemFailure_JVM_CORRUPTION_HAS_BEEN_DETECTED.toLocalizedString();
- static final String CALLING_SYSTEM_EXIT = LocalizedStrings.SystemFailure_SINCE_THIS_IS_A_DEDICATED_CACHE_SERVER_AND_THE_JVM_HAS_BEEN_CORRUPTED_THIS_PROCESS_WILL_NOW_TERMINATE_PERMISSION_TO_CALL_SYSTEM_EXIT_INT_WAS_GIVEN_IN_THE_FOLLOWING_CONTEXT.toLocalizedString();
- public static final String DISTRIBUTION_HALTED_MESSAGE = LocalizedStrings.SystemFailure_DISTRIBUTION_HALTED_DUE_TO_JVM_CORRUPTION.toLocalizedString();
- public static final String DISTRIBUTED_SYSTEM_DISCONNECTED_MESSAGE = LocalizedStrings.SystemFailure_DISTRIBUTED_SYSTEM_DISCONNECTED_DUE_TO_JVM_CORRUPTION.toLocalizedString();
-
- /**
- * the underlying failure
- *
- * This is usually an instance of {@link VirtualMachineError}, but it
- * is not required to be such.
- *
- * @see #getFailure()
- * @see #initiateFailure(Error)
- */
- protected static volatile Error failure = null;
-
- /**
- * user-defined runnable to run last
- *
- * @see #setFailureAction(Runnable)
- */
- private static volatile Runnable failureAction = new Runnable() {
- public void run() {
- System.err.println(JVM_CORRUPTION);
- failure.printStackTrace();
- }
- };
-
- /**
- * @see #setExitOK(boolean)
- */
- private static volatile boolean exitOK = false;
-
- /**
- * If we're going to exit the JVM, I want to be accountable for who
- * told us it was OK.
- */
- private static volatile Throwable exitExcuse;
-
- /**
- * Indicate whether it is acceptable to call {@link System#exit(int)} after
- * failure processing has completed.
- * <p>
- * This may be dynamically modified while the system is running.
- *
- * @param newVal true if it is OK to exit the process
- * @return the previous value
- */
- public static boolean setExitOK(boolean newVal) {
- boolean result = exitOK;
- exitOK = newVal;
- if (exitOK) {
- exitExcuse = new Throwable("SystemFailure exitOK set");
- }
- else {
- exitExcuse = null;
- }
- return result;
- }
-
- //merge42180: Added this method while merging 42180. It should have already be here through different merges or will come later
- /**
- * Returns true if the given Error is a fatal to the JVM and it should be shut
- * down. Code should call {@link #initiateFailure(Error)} or
- * {@link #setFailure(Error)} if this returns true.
- */
- public static boolean isJVMFailureError(Error err) {
- // all VirtualMachineErrors are not fatal to the JVM, in particular
- // StackOverflowError is not
- return err instanceof OutOfMemoryError || err instanceof UnknownError;
- }
- /**
- * Disallow instance creation
- */
- private SystemFailure() {
-
- }
-
- /**
- * Synchronizes access to state variables, used to notify the watchdog
- * when to run
- *
- * @see #notifyWatchDog()
- * @see #startProctor()
- * @see #startWatchDog()
- */
- private static final Object failureSync = new Object();
-
- /**
- * True if we have closed GemFire
- *
- * @see #emergencyClose()
- */
- private static volatile boolean gemfireCloseCompleted = false;
-
- /**
- * True if we have completed the user-defined failure action
- *
- * @see #setFailureAction(Runnable)
- */
- private static volatile boolean failureActionCompleted = false;
-
- /**
- * This is a logging ThreadGroup, created only once.
- */
- private final static ThreadGroup tg;
- static {
- tg = new ThreadGroup("SystemFailure Watchdog Threads") {
- // If the watchdog is correctly written, this will never get executed.
- // However, there's no reason for us not to eat our own dog food
- // (har, har) -- see the javadoc above.
- @Override
- public void uncaughtException(Thread t, Throwable e) {
- // Uhhh...if the watchdog is running, we *know* there's some
- // sort of serious error, no need to check for it here.
- System.err.println("Internal error in SystemFailure watchdog:" + e);
- e.printStackTrace();
- }
- };
- }
-
- /**
- * This is the amount of time, in seconds, the watchdog periodically awakens
- * to see if the system has been corrupted.
- * <p>
- * The watchdog will be explicitly awakened by calls to
- * {@link #setFailure(Error)} or {@link #initiateFailure(Error)}, but
- * it will awaken of its own accord periodically to check for failure even
- * if the above calls do not occur.
- * <p>
- * This can be set with the system property
- * <code>gemfire.WATCHDOG_WAIT</code>. The default is 15 sec.
- */
- static public final int WATCHDOG_WAIT = Integer
- .getInteger("gemfire.WATCHDOG_WAIT", 15).intValue();
-
- /**
- * This is the watchdog thread
- *
- * @guarded.By {@link #failureSync}
- */
- private static Thread watchDog;
-
- private static boolean isCacheClosing = false;
-
- /**
- * Should be invoked when GemFire cache is being created.
- */
- public static void signalCacheCreate() {
- isCacheClosing = false;
- }
-
- /**
- * Should be invoked when GemFire cache is closing or closed.
- */
- public static void signalCacheClose() {
- isCacheClosing = true;
- if (proctor != null) {
- proctor.interrupt();
- }
- if (watchDog != null) {
- watchDog.interrupt();
- }
- }
-
- /**
- * Start the watchdog thread, if it isn't already running.
- */
- private static void startWatchDog() {
- if (failureActionCompleted) {
- // Our work is done, don't restart
- return;
- }
- synchronized (failureSync) {
- if (watchDog != null && watchDog.isAlive()) {
- return;
- }
- watchDog = new Thread(tg, new Runnable() {
- public void run() {
- runWatchDog();
- }
- }, "SystemFailure WatchDog");
- watchDog.setDaemon(true);
- watchDog.start();
- }
- }
-
- private static void stopWatchDog() {
- Thread watchDogSnapshot = null;
- synchronized (failureSync) {
- stopping = true;
- if (watchDog != null && watchDog.isAlive()) {
- failureSync.notifyAll();
- watchDogSnapshot = watchDog;
- }
- }
- if(watchDogSnapshot != null) {
- try {
- watchDogSnapshot.join(100);
- } catch (InterruptedException ignore) {
- }
- if (watchDogSnapshot.isAlive()) {
- watchDogSnapshot.interrupt();
- try {
- watchDogSnapshot.join(SHUTDOWN_WAIT);
- } catch (InterruptedException ignore) {
- }
- }
- }
- }
-
- /**
- * This is the run loop for the watchdog thread.
- */
- static protected void runWatchDog() {
-
- boolean warned = false;
-
- logFine(WATCHDOG_NAME, "Starting");
- try {
- basicLoadEmergencyClasses();
- }
- catch (ExceptionInInitializerError e) {
- // Uhhh...are we shutting down?
- boolean noSurprise = false;
- Throwable cause = e.getCause();
- if (cause != null) {
- if (cause instanceof IllegalStateException) {
- String msg = cause.getMessage();
- if (msg.indexOf("Shutdown in progress") >= 0) {
- noSurprise = true;
- }
- }
- }
- if (!noSurprise) {
- logWarning(WATCHDOG_NAME, "Unable to load GemFire classes: ", e);
- }
- // In any event, we're toast
- return;
- }
- catch (CancelException e) {
- // ignore this because we are shutting down anyway
- }
- catch (Throwable t) {
- logWarning(WATCHDOG_NAME, "Unable to initialize watchdog", t);
- return;
- }
- for (;;) {
- if (stopping) {
- return;
- }
- try {
- if (isCacheClosing) {
- break;
- }
- // Sleep or get notified...
- synchronized (failureSync) {
- if (stopping) {
- return;
- }
- logFine(WATCHDOG_NAME, "Waiting for disaster");
- try {
- failureSync.wait(WATCHDOG_WAIT * 1000);
- }
- catch (InterruptedException e) {
- // Ignore
- }
- if (stopping) {
- return;
- }
- }
- // Poke nose in the air, take a sniff...
-
- if (failureActionCompleted) {
- // early out, for testing
- logInfo(WATCHDOG_NAME, "all actions completed; exiting");
- }
- if (failure == null) {
- // Tail wag. Go back to sleep.
- logFine(WATCHDOG_NAME, "no failure detected");
- continue;
- }
- // BOW WOW WOW WOW WOW! Corrupted system.
- if (!warned ) {
- warned = logWarning(WATCHDOG_NAME, "failure detected", failure);
- }
-
- // If any of the following fail, we will go back to sleep and
- // retry.
- if (!gemfireCloseCompleted) {
- logInfo(WATCHDOG_NAME, "closing GemFire");
- try {
- emergencyClose();
- }
- catch (Throwable t) {
- logWarning(WATCHDOG_NAME, "trouble closing GemFire", t);
- continue; // go back to sleep
- }
- gemfireCloseCompleted = true;
- }
-
- if (!failureActionCompleted) {
- // avoid potential race condition setting the runnable
- Runnable r = failureAction;
- if (r != null) {
- logInfo(WATCHDOG_NAME, "running user's runnable");
- try {
- r.run();
- }
- catch (Throwable t) {
- logWarning(WATCHDOG_NAME, "trouble running user's runnable", t);
- continue; // go back to sleep
- }
- }
- failureActionCompleted = true;
- }
-
- stopping = true;
- stopProctor();
-
- if (exitOK) {
- logWarning(WATCHDOG_NAME,
- // No "+" in this long message, we're out of memory!
- CALLING_SYSTEM_EXIT,
- exitExcuse);
-
- // ATTENTION: there are VERY FEW places in GemFire where it is
- // acceptable to call System.exit. This is one of those
- // places...
- System.exit(1);
- }
-
-
- // Our job here is done
- logInfo(WATCHDOG_NAME, "exiting");
- return;
- }
- catch (Throwable t) {
- // We *never* give up. NEVER EVER!
- logWarning(WATCHDOG_NAME, "thread encountered a problem: " + t, t);
- }
- } // for
- }
-
- /**
- * Spies on system statistics looking for low memory threshold
- *
- * Well, if you're gonna have a watchdog, why not a watch CAT????
- *
- * @guarded.By {@link #failureSync}
- * @see #minimumMemoryThreshold
- */
- private static Thread proctor;
-
- /**
- * This mutex controls access to {@link #firstStarveTime} and
- * {@link #minimumMemoryThreshold}.
- * <p>
- * I'm hoping that a fat lock is never created here, so that
- * an object allocation isn't necessary to acquire this
- * mutex. You'd have to have A LOT of contention on this mutex
- * in order for a fat lock to be created, which indicates IMHO
- * a serious problem in your applications.
- */
- private static final Object memorySync = new Object();
-
- /**
- * This is the minimum amount of memory that the proctor will
- * tolerate before declaring a system failure.
- *
- * @see #setFailureMemoryThreshold(long)
- * @guarded.By {@link #memorySync}
- */
- static long minimumMemoryThreshold = Long.getLong(
- "gemfire.SystemFailure.chronic_memory_threshold", 1048576).longValue();
-
- /**
- * This is the interval, in seconds, that the proctor
- * thread will awaken and poll system free memory.
- *
- * The default is 1 sec. This can be set using the system property
- * <code>gemfire.SystemFailure.MEMORY_POLL_INTERVAL</code>.
- *
- * @see #setFailureMemoryThreshold(long)
- */
- static final public long MEMORY_POLL_INTERVAL = Long.getLong(
- "gemfire.SystemFailure.MEMORY_POLL_INTERVAL", 1).longValue();
-
- /**
- * This is the maximum amount of time, in seconds, that the proctor thread
- * will tolerate seeing free memory stay below
- * {@link #setFailureMemoryThreshold(long)}, after which point it will
- * declare a system failure.
- *
- * The default is 15 sec. This can be set using the system property
- * <code>gemfire.SystemFailure.MEMORY_MAX_WAIT</code>.
- *
- * @see #setFailureMemoryThreshold(long)
- */
- static final public long MEMORY_MAX_WAIT = Long.getLong(
- "gemfire.SystemFailure.MEMORY_MAX_WAIT", 15).longValue();
-
- /**
- * Flag that determines whether or not we monitor memory on our own.
- * If this flag is set, we will check freeMemory, invoke GC if free memory
- * gets low, and start throwing our own OutOfMemoryException if
- *
- * The default is false, so this monitoring is turned off. This monitoring has been found
- * to be unreliable in non-Sun VMs when the VM is under stress or behaves in unpredictable ways.
- *
- * @since 6.5
- */
- static final public boolean MONITOR_MEMORY = Boolean.getBoolean(
- "gemfire.SystemFailure.MONITOR_MEMORY");
-
- /**
- * Start the proctor thread, if it isn't already running.
- *
- * @see #proctor
- */
- private static void startProctor() {
- if (failure != null) {
- // no point!
- notifyWatchDog();
- return;
- }
- synchronized (failureSync) {
- if (proctor != null && proctor.isAlive()) {
- return;
- }
- proctor = new Thread(tg, new Runnable() {
- public void run() {
- runProctor();
- }
- }, "SystemFailure Proctor");
- proctor.setDaemon(true);
- proctor.start();
- }
- }
-
- private static void stopProctor() {
- Thread proctorSnapshot = null;
- synchronized (failureSync) {
- stopping = true;
- proctorSnapshot = proctor;
- }
- if (proctorSnapshot != null && proctorSnapshot.isAlive()) {
- proctorSnapshot.interrupt();
- try {
- proctorSnapshot.join(SHUTDOWN_WAIT);
- } catch (InterruptedException ignore) {
- }
- }
- }
-
- /**
- * Symbolic representation of an invalid starve time
- */
- static private final long NEVER_STARVED = Long.MAX_VALUE;
-
- /**
- * this is the last time we saw memory starvation
- *
- * @guarded.By {@link #memorySync}}}
- */
- static private long firstStarveTime = NEVER_STARVED;
-
- /**
- * This is the previous measure of total memory. If it changes,
- * we reset the proctor's starve statistic.
- */
- static private long lastTotalMemory = 0;
-
- /**
- * This is the run loop for the proctor thread (formally known
- * as the "watchcat" (grin)
- */
- static protected void runProctor() {
- // Note that the javadocs say this can return Long.MAX_VALUE.
- // If it does, the proctor will never do its job...
- final long maxMemory = Runtime.getRuntime().maxMemory();
-
- // Allocate this error in advance, since it's too late once
- // it's been detected!
- final OutOfMemoryError oome = new OutOfMemoryError(LocalizedStrings.SystemFailure_0_MEMORY_HAS_REMAINED_CHRONICALLY_BELOW_1_BYTES_OUT_OF_A_MAXIMUM_OF_2_FOR_3_SEC.toLocalizedString(new Object[] {PROCTOR_NAME, Long.valueOf(minimumMemoryThreshold), Long.valueOf(maxMemory), Integer.valueOf(WATCHDOG_WAIT)}));
-
- // Catenation, but should be OK when starting up
- logFine(PROCTOR_NAME, "Starting, threshold = " + minimumMemoryThreshold
- + "; max = " + maxMemory);
- for (;;) {
- if (isCacheClosing) {
- break;
- }
- if (stopping) {
- return;
- }
-
- try {
- //*** catnap...
- try {
- Thread.sleep(MEMORY_POLL_INTERVAL * 1000);
- }
- catch (InterruptedException e) {
- // ignore
- }
-
- if (stopping) {
- return;
- }
-
- //*** Twitch ear, take a bath...
- if (failureActionCompleted) {
- // it's all over, we're late
- return;
- }
- if (failure != null) {
- notifyWatchDog(); // wake the dog, just in case
- logFine(PROCTOR_NAME, "Failure has been reported, exiting");
- return;
- }
-
- if(!MONITOR_MEMORY) {
- continue;
- }
-
- //*** Sit up, stretch...
- long totalMemory = Runtime.getRuntime().totalMemory();
- if (totalMemory < maxMemory) {
- // We haven't finished growing the heap, so no worries...yet
- if (DEBUG) {
- // This message has catenation, we don't want this in
- // production code :-)
- logFine(PROCTOR_NAME, "totalMemory (" + totalMemory
- + ") < maxMemory (" + maxMemory + ")");
- }
- firstStarveTime = NEVER_STARVED;
- continue;
- }
- if (lastTotalMemory < totalMemory) {
- // Don't get too impatient if the heap just now grew
- lastTotalMemory = totalMemory; // now we're maxed
- firstStarveTime = NEVER_STARVED; // reset the clock
- continue;
- }
- lastTotalMemory = totalMemory; // make a note of this
-
- //*** Hey, is that the food bowl?
-
- // At this point, freeMemory really indicates how much
- // trouble we're in.
- long freeMemory = Runtime.getRuntime().freeMemory();
- if(freeMemory==0) {
- /*
- * This is to workaround X bug #41821 in JRockit.
- * Often, Jrockit returns 0 from Runtime.getRuntime().freeMemory()
- * Allocating this one object and calling again seems to workaround the problem.
- */
- new Object();
- freeMemory = Runtime.getRuntime().freeMemory();
- }
- // Grab the threshold and starve time once, under mutex, because
- // it's publicly modifiable.
- long curThreshold;
- long lastStarveTime;
- synchronized (memorySync) {
- curThreshold = minimumMemoryThreshold;
- lastStarveTime = firstStarveTime;
- }
-
- if (freeMemory >= curThreshold /* enough memory */
- || curThreshold == 0 /* disabled */) {
- // Memory is FINE, reset everything
- if (DEBUG) {
- // This message has catenation, we don't want this in
- // production code :-)
- logFine(PROCTOR_NAME, "Current free memory is: " + freeMemory);
- }
-
- if (lastStarveTime != NEVER_STARVED) {
- logFine(PROCTOR_NAME, "...low memory has self-corrected.");
- }
- synchronized (memorySync) {
- firstStarveTime = NEVER_STARVED;
- }
- continue;
- }
- // Memory is low
-
- //*** Leap to feet, nose down, tail switching...
- long now = System.currentTimeMillis();
- if (lastStarveTime == NEVER_STARVED) {
- // first sighting
- if (DEBUG) {
- // Catenation in this message, don't put in production
- logFine(PROCTOR_NAME, "Noting current memory " + freeMemory
- + " is less than threshold " + curThreshold);
- }
- else {
- logWarning(
- PROCTOR_NAME,
- "Noting that current memory available is less than the currently designated threshold", null);
- }
-
- synchronized (memorySync) {
- firstStarveTime = now;
- }
- System.gc(); // at least TRY...
- continue;
- }
-
- //*** squirm, wait for the right moment...wait...wait...
- if (now - lastStarveTime < MEMORY_MAX_WAIT * 1000) {
- // Very recent; problem may correct itself.
- if (DEBUG) {
- // catenation
- logFine(PROCTOR_NAME, "...memory is still below threshold: "
- + freeMemory);
- }
- else {
- logWarning(
- PROCTOR_NAME,
- "Noting that current memory available is still below currently designated threshold", null);
-
- }
- continue;
- }
-
- //*** Meow! Meow! MEOWWWW!!!!!
-
- // Like any smart cat, let the Dog do all the work.
- logWarning(PROCTOR_NAME, "Memory is chronically low; setting failure!", null);
- SystemFailure.setFailure(oome);
- notifyWatchDog();
- return; // we're done!
- }
- catch (Throwable t) {
- logWarning(PROCTOR_NAME, "thread encountered a problem", t);
- // We *never* give up. NEVER EVER!
- }
- } // for
- }
-
- /**
- * Enables some fine logging
- */
- static private final boolean DEBUG = false;
-
- /**
- * If true, we track the progress of emergencyClose
- * on System.err
- */
- static public final boolean TRACE_CLOSE = false;
-
- static protected final String WATCHDOG_NAME = "SystemFailure Watchdog";
-
- static protected final String PROCTOR_NAME = "SystemFailure Proctor";
-
- /**
- * break any potential circularity in {@link #loadEmergencyClasses()}
- */
- private static volatile boolean emergencyClassesLoaded = false;
-
- /**
- * Since it requires object memory to unpack a jar file,
- * make sure this JVM has loaded the classes necessary for
- * closure <em>before</em> it becomes necessary to use them.
- * <p>
- * Note that just touching the class in order to load it
- * is usually sufficient, so all an implementation needs
- * to do is to reference the same classes used in
- * {@link #emergencyClose()}. Just make sure to do it while
- * you still have memory to succeed!
- */
- public static void loadEmergencyClasses() {
- // This method was called to basically load this class
- // and invoke its static initializers. Now that we don't
- // use statics to start the threads all we need to do is
- // call startThreads. The watchdog thread will call basicLoadEmergencyClasses.
- startThreads();
- }
- private static void basicLoadEmergencyClasses() {
- if (emergencyClassesLoaded) return;
- emergencyClassesLoaded = true;
- SystemFailureTestHook.loadEmergencyClasses(); // bug 50516
- GemFireCacheImpl.loadEmergencyClasses();
- RemoteGfManagerAgent.loadEmergencyClasses();
- }
-
- /**
- * Attempt to close any and all GemFire resources.
- *
- * The contract of this method is that it should not
- * acquire any synchronization mutexes nor create any objects.
- * <p>
- * The former is because the system is in an undefined state and
- * attempting to acquire the mutex may cause a hang.
- * <p>
- * The latter is because the likelihood is that we are invoking
- * this method due to memory exhaustion, so any attempt to create
- * an object will also cause a hang.
- * <p>
- * This method is not meant to be called directly (but, well, I
- * guess it could). It is public to document the contract
- * that is implemented by <code>emergencyClose</code> in other
- * parts of the system.
- */
- public static void emergencyClose() {
- // Make the cache (more) useless and inaccessible...
- if (TRACE_CLOSE) {
- System.err.println("SystemFailure: closing GemFireCache");
- }
- GemFireCacheImpl.emergencyClose();
-
- // Arcane strange DS's exist in this class:
- if (TRACE_CLOSE) {
- System.err.println("SystemFailure: closing admins");
- }
- RemoteGfManagerAgent.emergencyClose();
-
- // If memory was the problem, make an explicit attempt at
- // this point to clean up.
-
- System.gc(); // This will fail if we're out of memory?/
-
- if (TRACE_CLOSE) {
- System.err.println("SystemFailure: end of emergencyClose");
- }
- }
-
- /**
- * Throw the system failure.
- *
- * This method does not return normally.
- * <p>
- * Unfortunately, attempting to create a new Throwable at this
- * point may cause the thread to hang (instead of generating
- * another OutOfMemoryError), so we have to make do with whatever
- * Error we have, instead of wrapping it with one pertinent
- * to the current context. See bug 38394.
- *
- * @throws Error
- */
- static private void throwFailure() throws InternalGemFireError, Error {
- // Do not return normally...
- if (failure != null) throw failure;
- }
-
- /**
- * Notifies the watchdog thread (assumes that {@link #failure} has been set)
- */
- private static void notifyWatchDog() {
- startWatchDog(); // just in case
- synchronized (failureSync) {
- failureSync.notifyAll();
- }
- }
-
- /**
- * Utility function to check for failures. If a failure is
- * detected, this methods throws an AssertionFailure.
- *
- * @see #initiateFailure(Error)
- * @throws InternalGemFireError if the system has been corrupted
- * @throws Error if the system has been corrupted and a thread-specific
- * AssertionError cannot be allocated
- */
- public static void checkFailure() throws InternalGemFireError, Error {
- if (failure == null) {
- return;
- }
- notifyWatchDog();
- throwFailure();
- }
-
- /**
- * Signals that a system failure has occurred and then throws an
- * AssertionError.
- *
- * @param f the failure to set
- * @throws IllegalArgumentException if f is null
- * @throws InternalGemFireError always; this method does not return normally.
- * @throws Error if a thread-specific AssertionError cannot be allocated.
- */
- public static void initiateFailure(Error f) throws InternalGemFireError, Error {
- SystemFailure.setFailure(f);
- throwFailure();
- }
-
- /**
- * Set the underlying system failure, if not already set.
- * <p>
- * This method does not generate an error, and should only be used
- * in circumstances where execution needs to continue, such as when
- * re-implementing {@link ThreadGroup#uncaughtException(Thread, Throwable)}.
- *
- * @param failure the system failure
- * @throws IllegalArgumentException if you attempt to set the failure to null
- */
- public static void setFailure(Error failure) {
- if (failure == null) {
- throw new IllegalArgumentException(LocalizedStrings.SystemFailure_YOU_ARE_NOT_PERMITTED_TO_UNSET_A_SYSTEM_FAILURE.toLocalizedString());
- }
- if (SystemFailureTestHook.errorIsExpected(failure)) {
- return;
- }
- // created (OutOfMemoryError), and no stack frames are created
- // (StackOverflowError). There is a slight chance that the
- // very first error may get overwritten, but this avoids the
- // potential of object creation via a fat lock
- SystemFailure.failure = failure;
- notifyWatchDog();
- }
-
- /**
- * Returns the catastrophic system failure, if any.
- * <p>
- * This is usually (though not necessarily) an instance of
- * {@link VirtualMachineError}.
- * <p>
- * A return value of null indicates that no system failure has yet been
- * detected.
- * <p>
- * Object synchronization can implicitly require object creation (fat locks
- * in JRockit for instance), so the underlying value is not synchronized
- * (it is a volatile). This means the return value from this call is not
- * necessarily the <em>first</em> failure reported by the JVM.
- * <p>
- * Note that even if it <em>were</em> synchronized, it would only be a
- * proximal indicator near the time that the JVM crashed, and may not
- * actually reflect the underlying root cause that generated the failure.
- * For instance, if your JVM is running short of memory, this Throwable is
- * probably an innocent victim and <em>not</em> the actual allocation (or
- * series of allocations) that caused your JVM to exhaust memory.
- * <p>
- * If this function returns a non-null value, keep in mind that the JVM is
- * very limited. In particular, any attempt to allocate objects may fail
- * if the original failure was an OutOfMemoryError.
- *
- * @return the failure, if any
- */
- public static Error getFailure() {
- return failure;
- }
-
- /**
- * Sets a user-defined action that is run in the event
- * that failure has been detected.
- * <p>
- * This action is run <em>after</em> the GemFire cache has been shut down.
- * If it throws any error, it will be reattempted indefinitely until it
- * succeeds. This action may be dynamically modified while the system
- * is running.
- * <p>
- * The default action prints the failure stack trace to System.err.
- *
- * @see #initiateFailure(Error)
- * @param action the Runnable to use
- * @return the previous action
- */
- public static Runnable setFailureAction(Runnable action) {
- Runnable old = SystemFailure.failureAction;
- SystemFailure.failureAction = action;
- return old;
- }
-
- /**
- * Set the memory threshold under which system failure will be
- * notified.
- *
- * This value may be dynamically modified while the system
- * is running. The default is 1048576 bytes. This can be set using the
- * system property <code>gemfire.SystemFailure.chronic_memory_threshold</code>.
- *
- * @param newVal threshold in bytes
- * @return the old threshold
- * @see Runtime#freeMemory()
- */
- public static long setFailureMemoryThreshold(long newVal) {
- long result;
- synchronized (memorySync) {
- result = minimumMemoryThreshold;
- minimumMemoryThreshold = newVal;
- firstStarveTime = NEVER_STARVED; // reset
- }
- startProctor(); // just in case
- return result;
- }
-
-// /**
-// * For use by GemStone Quality Assurance Only
-// *
-// * @deprecated TODO remove this
-// */
-// public static void reset() {
-// System.gc();
-// logWarning("DJP", "do not commit SystemFailure#reset", null);
-// failure = null;
-// failureAction = new Runnable() {
-// public void run() {
-// System.err.println("(SystemFailure) JVM corruption has been detected!");
-// failure.printStackTrace();
-// }
-// };
-// gemfireCloseCompleted = false;
-// failureActionCompleted = false;
-// synchronized (failureSync) {
-// if (watchDog != null) {
-// watchDog.interrupt();
-// }
-// watchDog = null;
-// if (watchCat != null) {
-// watchCat.interrupt();
-// }
-// watchCat = null;
-// }
-//
-// startWatchDog();
-// startWatchCat();
-// }
-
- static private boolean logStdErr(String kind, String name, String s, Throwable t) {
- // As far as I can tell, this code path doesn't allocate
- // any objects!!!!
- try {
- System.err.print(name);
- System.err.print(": [");
- System.err.print(kind);
- System.err.print("] ");
- System.err.println(s);
- if (t != null) {
- t.printStackTrace();
- }
- return true;
- }
- catch (Throwable t2) {
- // out of luck
- return false;
- }
- }
-
- /**
- * Logging can require allocation of objects, so we wrap the
- * logger so that failures are silently ignored.
- *
- * @param s string to print
- * @param t the call stack, if any
- * @return true if the warning got printed
- */
- static protected boolean logWarning(String name, String s, Throwable t) {
- return logStdErr("warning", name, s, t);
-// if (PREFER_STDERR) {
-// return logStdErr("warning", name, s, t);
-// }
-// try {
-// log.warning(name + ": " + s, t);
-// return true;
-// }
-// catch (Throwable t2) {
-// return logStdErr("warning", name, s, t);
-// }
- }
-
- /**
- * Logging can require allocation of objects, so we wrap the
- * logger so that failures are silently ignored.
- *
- * @param s string to print
- */
- static protected void logInfo(String name, String s) {
- logStdErr("info", name, s, null);
-// if (PREFER_STDERR) {
-// logStdErr("info", name, s, null);
-// return;
-// }
-// try {
-// log.info(name + ": " + s);
-// }
-// catch (Throwable t) {
-// logStdErr("info", name, s, t);
-// }
- }
-
- /**
- * Logging can require allocation of objects, so we wrap the
- * logger so that failures are silently ignored.
- *
- * @param s string to print
- */
- static protected void logFine(String name, String s) {
- if (DEBUG) {
- logStdErr("fine", name, s, null);
- }
-// if (DEBUG && PREFER_STDERR) {
-// logStdErr("fine", name, s, null);
-// return;
-// }
-// try {
-// log.fine(name + ": " + s);
-// }
-// catch (Throwable t) {
-// if (DEBUG) {
-// logStdErr("fine", name, s, null);
-// }
-// }
- }
-
- private static volatile boolean stopping;
-
- /**
- * This starts up the watchdog and proctor threads.
- * This method is called when a Cache is created.
- */
- public static void startThreads() {
- stopping = false;
- startWatchDog();
- startProctor();
- }
- /**
- * This stops the threads that implement this service.
- * This method is called when a Cache is closed.
- */
- public static void stopThreads() {
- // this method fixes bug 45409
- stopping = true;
- stopProctor();
- stopWatchDog();
- }
-
- static Thread getWatchDogForTest() {
- return watchDog;
- }
-
- static Thread getProctorForTest() {
- return proctor;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f6c4c2f9/gemfire-core/src/main/java/com/gemstone/gemfire/SystemIsRunningException.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/SystemIsRunningException.java b/gemfire-core/src/main/java/com/gemstone/gemfire/SystemIsRunningException.java
deleted file mode 100644
index e96ddf4..0000000
--- a/gemfire-core/src/main/java/com/gemstone/gemfire/SystemIsRunningException.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.
- */
-package com.gemstone.gemfire;
-
-/**
- * A <code>SystemIsRunningException</code> is thrown when an operation
- * is attempted that requires that the locator is stopped.
- * <p>
- * In some cases this exception may be thrown and the locator will
- * not be running. This will happen if the locator was not stopped
- * cleanly.
- * <p>As of GemFire 5.0 this exception should be named LocatorIsRunningException.
- */
-public class SystemIsRunningException extends GemFireException {
-private static final long serialVersionUID = 3516268055878767189L;
-
- ////////////////////// Constructors //////////////////////
-
- /**
- * Creates a new <code>SystemIsRunningException</code>.
- */
- public SystemIsRunningException() {
- super();
- }
-
- /**
- * Creates a new <code>SystemIsRunningException</code>.
- */
- public SystemIsRunningException(String message) {
- super(message);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f6c4c2f9/gemfire-core/src/main/java/com/gemstone/gemfire/ThreadInterruptedException.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/ThreadInterruptedException.java b/gemfire-core/src/main/java/com/gemstone/gemfire/ThreadInterruptedException.java
deleted file mode 100644
index 6c459d3..0000000
--- a/gemfire-core/src/main/java/com/gemstone/gemfire/ThreadInterruptedException.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.
- */
-package com.gemstone.gemfire;
-
-/**
- * @deprecated this class is no longer used
- */
-
-@Deprecated
-public final class ThreadInterruptedException extends CancelException {
-private static final long serialVersionUID = 6169940883541267514L;
- /**
- * Do not create instances of this class
- */
- private ThreadInterruptedException() { }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f6c4c2f9/gemfire-core/src/main/java/com/gemstone/gemfire/ToDataException.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/ToDataException.java b/gemfire-core/src/main/java/com/gemstone/gemfire/ToDataException.java
deleted file mode 100644
index 7618e32..0000000
--- a/gemfire-core/src/main/java/com/gemstone/gemfire/ToDataException.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.
- */
-package com.gemstone.gemfire;
-
-/**
- * A <code>ToDataException</code> is thrown during serialization if
- * {@link DataSerializable#toData} throws an exception or if
- * {@link DataSerializer#toData} is called and returns false.
- *
- * @since 6.5
- * @author darrel
- */
-public class ToDataException extends SerializationException {
- private static final long serialVersionUID = -2329606027453879918L;
- /**
- * Creates a new <code>ToDataException</code> with the given message
- */
- public ToDataException(String message) {
- super(message);
- }
- /**
- * Creates a new <code>ToDataException</code> with the given message
- * and cause.
- */
- public ToDataException(String message, Throwable cause) {
- super(message, cause);
- }
-}