You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by rv...@apache.org on 2015/04/28 23:40:52 UTC
[47/51] [partial] incubator-geode git commit: Init
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/19459053/gemfire-core/src/main/java/com/gemstone/gemfire/Delta.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/Delta.java b/gemfire-core/src/main/java/com/gemstone/gemfire/Delta.java
new file mode 100755
index 0000000..5d44249
--- /dev/null
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/Delta.java
@@ -0,0 +1,57 @@
+/*=========================================================================
+ * Copyright (c) 2002-2014 Pivotal Software, Inc. All Rights Reserved.
+ * This product is protected by U.S. and international copyright
+ * and intellectual property laws. Pivotal products are covered by
+ * more patents listed at http://www.pivotal.io/patents.
+ *=========================================================================
+ */
+package com.gemstone.gemfire;
+
+import java.io.DataInput;
+import java.io.DataOutput;
+import java.io.IOException;
+
+
+/**
+ * This interface defines a contract between the application and GemFire that
+ * allows GemFire to determine whether an application object contains a delta,
+ * allows GemFire to extract the delta from an application object, and generate
+ * a new application object by applying a delta to an existing application
+ * object. The difference in object state is contained in the {@link DataOutput}
+ * and {@link DataInput} parameters.
+ *
+ * @since 6.1
+ *
+ */
+public interface Delta {
+
+ /**
+ * Returns true if this object has pending changes it can write out.
+ */
+ boolean hasDelta();
+
+ /**
+ * This method is invoked on an application object at the delta sender, if
+ * GemFire determines the presence of a delta by calling
+ * {@link Delta#hasDelta()} on the object. The delta is written to the
+ * {@link DataOutput} object provided by GemFire.
+ *
+ * Any delta state should be reset in this method.
+ *
+ * @throws IOException
+ */
+ void toDelta(DataOutput out) throws IOException;
+
+
+ /**
+ * This method is invoked on an existing application object when an update is
+ * received as a delta. This method throws an {@link InvalidDeltaException}
+ * when the delta in the {@link DataInput} cannot be applied to the object.
+ * GemFire automatically handles an {@link InvalidDeltaException} by
+ * reattempting the update by sending the full application object.
+ *
+ * @throws IOException
+ * @throws InvalidDeltaException
+ */
+ void fromDelta(DataInput in) throws IOException, InvalidDeltaException;
+}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/19459053/gemfire-core/src/main/java/com/gemstone/gemfire/DeltaSerializationException.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/DeltaSerializationException.java b/gemfire-core/src/main/java/com/gemstone/gemfire/DeltaSerializationException.java
new file mode 100644
index 0000000..5476939
--- /dev/null
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/DeltaSerializationException.java
@@ -0,0 +1,50 @@
+/*=========================================================================
+ * Copyright (c) 2010-2014 Pivotal Software, Inc. All Rights Reserved.
+ * This product is protected by U.S. and international copyright
+ * and intellectual property laws. Pivotal products are covered by
+ * one or more patents listed at http://www.pivotal.io/patents.
+ *=========================================================================
+ */
+/**
+ *
+ */
+package com.gemstone.gemfire;
+
+/**
+ * This exception wraps any checked exception encountered during invocation of
+ * {@link Delta#fromDelta(java.io.DataInput)} or
+ * {@link Delta#toDelta(java.io.DataOutput)} in GemFire.
+ *
+ * @since 6.5
+ */
+public class DeltaSerializationException extends RuntimeException {
+
+ /**
+ * Default constructor
+ */
+ public DeltaSerializationException() {
+ }
+
+ /**
+ * @param message
+ */
+ public DeltaSerializationException(String message) {
+ super(message);
+ }
+
+ /**
+ * @param cause
+ */
+ public DeltaSerializationException(Throwable cause) {
+ super(cause);
+ }
+
+ /**
+ * @param message
+ * @param cause
+ */
+ public DeltaSerializationException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/19459053/gemfire-core/src/main/java/com/gemstone/gemfire/ForcedDisconnectException.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/ForcedDisconnectException.java b/gemfire-core/src/main/java/com/gemstone/gemfire/ForcedDisconnectException.java
new file mode 100755
index 0000000..8618d63
--- /dev/null
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/ForcedDisconnectException.java
@@ -0,0 +1,32 @@
+/*=========================================================================
+ * Copyright (c) 2002-2014 Pivotal Software, Inc. All Rights Reserved.
+ * This product is protected by U.S. and international copyright
+ * and intellectual property laws. Pivotal products are covered by
+ * more patents listed at http://www.pivotal.io/patents.
+ *========================================================================
+ */
+package com.gemstone.gemfire;
+
+/**
+ * An <code>ForcedDisconnectException</code> is thrown when a GemFire
+ * application is removed from the distributed system due to membership
+ * constraints such as network partition detection.
+ *
+ * @since 5.7
+ */
+public class ForcedDisconnectException extends CancelException {
+private static final long serialVersionUID = 4977003259880566257L;
+
+ ////////////////////// Constructors //////////////////////
+
+ /**
+ * Creates a new <code>SystemConnectException</code>.
+ */
+ public ForcedDisconnectException(String message) {
+ super(message);
+ }
+
+ public ForcedDisconnectException(String message, Throwable cause) {
+ super(message, cause);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/19459053/gemfire-core/src/main/java/com/gemstone/gemfire/GemFireCacheException.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/GemFireCacheException.java b/gemfire-core/src/main/java/com/gemstone/gemfire/GemFireCacheException.java
new file mode 100644
index 0000000..aca728a
--- /dev/null
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/GemFireCacheException.java
@@ -0,0 +1,41 @@
+/*=========================================================================
+ * Copyright (c) 2010-2014 Pivotal Software, Inc. All Rights Reserved.
+ * This product is protected by U.S. and international copyright
+ * and intellectual property laws. Pivotal products are covered by
+ * one or more patents listed at http://www.pivotal.io/patents.
+ *=========================================================================
+ */
+package com.gemstone.gemfire;
+
+import com.gemstone.gemfire.cache.CacheException;
+
+/**
+ * An <code>GemFireCacheException</code> is used to wrap a
+ * {@link CacheException}. This is needed in contexts that can
+ * not throw the cache exception directly because of it being
+ * a typed exception.
+ */
+public class GemFireCacheException extends GemFireException {
+private static final long serialVersionUID = -2844020916351682908L;
+
+ ////////////////////// Constructors //////////////////////
+
+ /**
+ * Creates a new <code>GemFireCacheException</code>.
+ */
+ public GemFireCacheException(String message, CacheException ex) {
+ super(message, ex);
+ }
+ /**
+ * Creates a new <code>GemFireCacheException</code>.
+ */
+ public GemFireCacheException(CacheException ex) {
+ super(ex);
+ }
+ /**
+ * Gets the wrapped {@link CacheException}
+ */
+ public CacheException getCacheException() {
+ return (CacheException)getCause();
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/19459053/gemfire-core/src/main/java/com/gemstone/gemfire/GemFireCheckedException.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/GemFireCheckedException.java b/gemfire-core/src/main/java/com/gemstone/gemfire/GemFireCheckedException.java
new file mode 100644
index 0000000..50dbfa4
--- /dev/null
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/GemFireCheckedException.java
@@ -0,0 +1,81 @@
+/*=========================================================================
+ * Copyright (c) 2002-2014 Pivotal Software, Inc. All Rights Reserved.
+ * This product is protected by U.S. and international copyright
+ * and intellectual property laws. Pivotal products are covered by
+ * more patents listed at http://www.pivotal.io/patents.
+ *========================================================================
+ */
+
+package com.gemstone.gemfire;
+
+/**
+ * This is the abstract superclass of exceptions that are thrown and
+ * declared.
+ * <p>
+ * This class ought to be called <em>GemFireException</em>, but that name
+ * is reserved for an older class that extends {@link java.lang.RuntimeException}.
+ *
+ * @see com.gemstone.gemfire.GemFireException
+ * @since 5.1
+ */
+public abstract class GemFireCheckedException extends Exception {
+
+ ////////////////////// Constructors //////////////////////
+
+ /**
+ * Creates a new <code>GemFireException</code> with no detailed message.
+ */
+ public GemFireCheckedException() {
+ super();
+ }
+
+ /**
+ * Creates a new <code>GemFireCheckedException</code> with the given detail
+ * message.
+ */
+ public GemFireCheckedException(String message) {
+ super(message);
+ }
+
+ /**
+ * Creates a new <code>GemFireException</code> with the given detail
+ * message and cause.
+ */
+ public GemFireCheckedException(String message, Throwable cause) {
+ super(message);
+ this.initCause(cause);
+ }
+
+ /**
+ * Creates a new <code>GemFireCheckedException</code> with the given cause and
+ * no detail message
+ */
+ public GemFireCheckedException(Throwable cause) {
+ super();
+ this.initCause(cause);
+ }
+
+ //////////////////// Instance Methods ////////////////////
+
+ /**
+ * Returns the root cause of this <code>GemFireCheckedException</code> or
+ * <code>null</code> if the cause is nonexistent or unknown.
+ */
+ public Throwable getRootCause() {
+ if ( this.getCause() == null ) return null;
+ Throwable root = this.getCause();
+ while ( root != null ) {
+// if ( ! ( root instanceof GemFireCheckedException )) {
+// break;
+// }
+// GemFireCheckedException tmp = (GemFireCheckedException) root;
+ if ( root.getCause() == null ) {
+ break;
+ } else {
+ root = root.getCause();
+ }
+ }
+ return root;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/19459053/gemfire-core/src/main/java/com/gemstone/gemfire/GemFireConfigException.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/GemFireConfigException.java b/gemfire-core/src/main/java/com/gemstone/gemfire/GemFireConfigException.java
new file mode 100644
index 0000000..5678eb7
--- /dev/null
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/GemFireConfigException.java
@@ -0,0 +1,33 @@
+/*=========================================================================
+ * Copyright (c) 2002-2014 Pivotal Software, Inc. All Rights Reserved.
+ * This product is protected by U.S. and international copyright
+ * and intellectual property laws. Pivotal products are covered by
+ * more patents listed at http://www.pivotal.io/patents.
+ *========================================================================
+ */
+
+package com.gemstone.gemfire;
+
+/**
+ * A <code>GemFireConfigException</code> is used for failures
+ * while processing a GemFire configuration XML file.
+ */
+public class GemFireConfigException extends GemFireException {
+private static final long serialVersionUID = 7791789785331120991L;
+
+ ////////////////////// Constructors //////////////////////
+
+ /**
+ * Creates a new <code>GemFireConfigException</code>.
+ */
+ public GemFireConfigException(String message) {
+ super(message);
+ }
+
+ /**
+ * Creates a new <code>GemFireConfigException</code>.
+ */
+ public GemFireConfigException(String message, Throwable cause) {
+ super(message, cause);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/19459053/gemfire-core/src/main/java/com/gemstone/gemfire/GemFireException.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/GemFireException.java b/gemfire-core/src/main/java/com/gemstone/gemfire/GemFireException.java
new file mode 100644
index 0000000..0a1087a
--- /dev/null
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/GemFireException.java
@@ -0,0 +1,140 @@
+/*=========================================================================
+ * Copyright (c) 2002-2014 Pivotal Software, Inc. All Rights Reserved.
+ * This product is protected by U.S. and international copyright
+ * and intellectual property laws. Pivotal products are covered by
+ * more patents listed at http://www.pivotal.io/patents.
+ *========================================================================
+ */
+
+package com.gemstone.gemfire;
+
+/**
+ * This is the abstract superclass of exceptions that are thrown to
+ * indicate incorrect usage of GemFire.
+ *
+ * Since these exceptions are unchecked, this class really
+ * <em>ought</em> to be called <code>GemFireRuntimeException</code>;
+ * however, the current name is retained for compatibility's sake.
+ *
+ * @author David Whitlock
+ * @see com.gemstone.gemfire.GemFireCheckedException
+ * @see com.gemstone.gemfire.cache.CacheRuntimeException
+ */
+// Implementation note: This class is abstract so that we are forced
+// to have more specific exception types. We want to avoid using
+// GemFireException to describe an arbitrary error condition (think
+// GsError).
+public abstract class GemFireException extends RuntimeException {
+
+ /** The cause of this <code>GemFireException</code> */
+// private Throwable cause;
+
+ ////////////////////// Constructors //////////////////////
+
+ /**
+ * Creates a new <code>GemFireException</code> with no detailed message.
+ */
+ public GemFireException() {
+ super();
+ }
+
+ /**
+ * Creates a new <code>GemFireException</code> with the given detail
+ * message.
+ */
+ public GemFireException(String message) {
+ super(message);
+ }
+
+ /**
+ * Creates a new <code>GemFireException</code> with the given detail
+ * message and cause.
+ */
+ public GemFireException(String message, Throwable cause) {
+ super(message, cause);
+// this.cause = cause;
+ }
+
+ /**
+ * Creates a new <code>GemFireException</code> with the given cause and
+ * no detail message
+ */
+ public GemFireException(Throwable cause) {
+ super(cause);
+// this.cause = cause;
+ }
+
+ //////////////////// Instance Methods ////////////////////
+
+ /**
+ * Returns the cause of this <code>GemFireException</code> or
+ * <code>null</code> if the cause is nonexistent or unknown.
+ */
+// public Throwable getCause() {
+// return this.cause;
+// }
+
+ /**
+ * Returns the root cause of this <code>GemFireException</code> or
+ * <code>null</code> if the cause is nonexistent or unknown.
+ */
+ public Throwable getRootCause() {
+ if ( this.getCause() == null ) {
+ return null;
+ }
+ Throwable root = this.getCause();
+ while ( root.getCause() != null ) {
+ root = root.getCause();
+ }
+ return root;
+ }
+
+// public void printStackTrace() {
+// super.printStackTrace();
+// if (this.cause != null) {
+// System.err.println("Caused by:");
+// this.cause.printStackTrace();
+// }
+// }
+
+// public void printStackTrace(java.io.PrintWriter pw) {
+// super.printStackTrace(pw);
+//
+// if (this.cause != null) {
+// pw.println("Caused by:");
+// this.cause.printStackTrace(pw);
+// }
+// }
+//
+// public String getMessage() {
+// if (this.cause != null) {
+// String ourMsg = super.getMessage();
+// if (ourMsg == null || ourMsg.length() == 0) {
+// //ourMsg = super.toString(); //causes inifinite recursion
+// ourMsg = "";
+// }
+// StringBuffer sb = new StringBuffer(ourMsg);
+// sb.append(" Caused by: ");
+// String causeMsg = this.cause.getMessage();
+// if (causeMsg == null || causeMsg.length() == 0) {
+// causeMsg = this.cause.toString();
+// }
+// sb.append(causeMsg);
+// return sb.toString();
+// } else {
+// return super.getMessage();
+// }
+// }
+
+ /**
+ * Represent the receiver as well as the cause
+ */
+// public String toString() {
+// String result = super.toString();
+// if (cause != null) {
+// result = result + ", caused by " + cause.toString();
+// }
+// return result;
+// }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/19459053/gemfire-core/src/main/java/com/gemstone/gemfire/GemFireIOException.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/GemFireIOException.java b/gemfire-core/src/main/java/com/gemstone/gemfire/GemFireIOException.java
new file mode 100644
index 0000000..545675a
--- /dev/null
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/GemFireIOException.java
@@ -0,0 +1,32 @@
+/*=========================================================================
+ * Copyright (c) 2002-2014 Pivotal Software, Inc. All Rights Reserved.
+ * This product is protected by U.S. and international copyright
+ * and intellectual property laws. Pivotal products are covered by
+ * more patents listed at http://www.pivotal.io/patents.
+ *========================================================================
+ */
+
+package com.gemstone.gemfire;
+
+/**
+ * A <code>GemFireIOException</code> is thrown when a
+ * GemFire operation failure is caused by an <code>IOException</code>.
+ *
+ * @author David Whitlock
+ *
+ */
+public class GemFireIOException extends GemFireException {
+private static final long serialVersionUID = 5694009444435264497L;
+
+ ////////////////////// Constructors //////////////////////
+
+ /**
+ * Creates a new <code>GemFireIOException</code>.
+ */
+ public GemFireIOException(String message, Throwable cause) {
+ super(message, cause);
+ }
+ public GemFireIOException(String message) {
+ super(message);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/19459053/gemfire-core/src/main/java/com/gemstone/gemfire/GemFireRethrowable.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/GemFireRethrowable.java b/gemfire-core/src/main/java/com/gemstone/gemfire/GemFireRethrowable.java
new file mode 100644
index 0000000..7499e90
--- /dev/null
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/GemFireRethrowable.java
@@ -0,0 +1,38 @@
+/*=========================================================================
+ * Copyright (c) 2010-2014 Pivotal Software, Inc. All Rights Reserved.
+ * This product is protected by U.S. and international copyright
+ * and intellectual property laws. Pivotal products are covered by
+ * one or more patents listed at http://www.pivotal.io/patents.
+ *=========================================================================
+ */
+package com.gemstone.gemfire;
+
+/**
+ * This error is used by GemFire for internal purposes.
+ * It does not indicate an error condition.
+ * For this reason it is named "Rethrowable" instead of the standard "Error".
+ * It was made an <code>Error</code> to make it easier for user code that typically would
+ * catch <code>Exception</code> to not accidently catch this exception.
+ * <p> Note: if user code catches this error (or its subclasses) then it <em>must</em>
+ * be rethrown.
+ *
+ * @author darrel
+ * @since 5.7
+ */
+public class GemFireRethrowable extends Error {
+ private static final long serialVersionUID = 8349791552668922571L;
+
+ /**
+ * Create a GemFireRethrowable.
+ */
+ public GemFireRethrowable() {
+ }
+
+ /**
+ * Create a GemFireRethrowable with the specified message.
+ * @param message
+ */
+ public GemFireRethrowable(String message) {
+ super(message);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/19459053/gemfire-core/src/main/java/com/gemstone/gemfire/IncompatibleSystemException.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/IncompatibleSystemException.java b/gemfire-core/src/main/java/com/gemstone/gemfire/IncompatibleSystemException.java
new file mode 100644
index 0000000..98aebf4
--- /dev/null
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/IncompatibleSystemException.java
@@ -0,0 +1,29 @@
+/*=========================================================================
+ * Copyright (c) 2002-2014 Pivotal Software, Inc. All Rights Reserved.
+ * This product is protected by U.S. and international copyright
+ * and intellectual property laws. Pivotal products are covered by
+ * more patents listed at http://www.pivotal.io/patents.
+ *========================================================================
+ */
+package com.gemstone.gemfire;
+
+/**
+ * An <code>IncompatibleSystemException</code> is thrown when a
+ * new GemFire process tries to connect to an
+ * existing distributed system and its version is not the same as
+ * that of the distributed system. In this case the new member is
+ * not allowed to connect to the distributed system.
+ * <p>As of GemFire 5.0 this exception should be named IncompatibleDistributedSystemException
+ */
+public class IncompatibleSystemException extends GemFireException {
+private static final long serialVersionUID = -6852188720149734350L;
+
+ ////////////////////// Constructors //////////////////////
+
+ /**
+ * Creates a new <code>IncompatibleSystemException</code>.
+ */
+ public IncompatibleSystemException(String message) {
+ super(message);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/19459053/gemfire-core/src/main/java/com/gemstone/gemfire/Instantiator.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/Instantiator.java b/gemfire-core/src/main/java/com/gemstone/gemfire/Instantiator.java
new file mode 100644
index 0000000..90ec175
--- /dev/null
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/Instantiator.java
@@ -0,0 +1,303 @@
+/*=========================================================================
+ * Copyright (c) 2010-2014 Pivotal Software, Inc. All Rights Reserved.
+ * This product is protected by U.S. and international copyright
+ * and intellectual property laws. Pivotal products are covered by
+ * one or more patents listed at http://www.pivotal.io/patents.
+ *=========================================================================
+ */
+package com.gemstone.gemfire;
+
+import com.gemstone.gemfire.internal.InternalInstantiator;
+import com.gemstone.gemfire.internal.cache.EventID;
+import com.gemstone.gemfire.internal.cache.tier.sockets.ClientProxyMembershipID;
+import com.gemstone.gemfire.internal.i18n.LocalizedStrings;
+
+/**
+ * <code>Instantiator</code> allows classes that implement {@link
+ * DataSerializable} to be registered with the data serialization
+ * framework. Knowledge of <code>DataSerializable</code> classes
+ * allows the framework to optimize how instances of those classes are
+ * data serialized.
+ *
+ * <P>
+ *
+ * Ordinarily, when a <code>DataSerializable</code> object is written
+ * using {@link DataSerializer#writeObject(Object, java.io.DataOutput)}, a special marker class id
+ * is written to the stream followed by the class name of the
+ * <code>DataSerializable</code> object. After the marker class id is
+ * read by {@link DataSerializer#readObject} it performs the following
+ * operations,
+ *
+ * <OL>
+ *
+ * <LI>The class name is read</LI>
+ *
+ * <LI>The class is loaded using {@link Class#forName(java.lang.String)}</LI>
+ *
+ * <LI>An instance of the class is created using reflection</LI>
+ *
+ * <LI>{@link DataSerializable#fromData} is invoked on the
+ * newly-created object</LI>
+ *
+ * </OL>
+ *
+ * However, if a <code>DataSerializable</code> class is {@linkplain
+ * #register(Instantiator) registered} with the data serialization framework and
+ * assigned a unique class id, an important optimization can be
+ * performed that avoid the expense of using reflection to instantiate
+ * the <code>DataSerializable</code> class. When the object is
+ * written using {@link DataSerializer#writeObject(Object, java.io.DataOutput)}, the object's
+ * registered class id is written to the stream. Consequently, when
+ * the data is read from the stream, the {@link #newInstance} method
+ * of the appropriate <code>Instantiator</code> instance is invoked to
+ * create an "empty" instance of the <code>DataSerializable</code>
+ * instead of using reflection to create the new instance.
+ *
+ * <P>
+ *
+ * Commonly, a <code>DataSerializable</code> class will register
+ * itself with the <code>Instantiator</code> in a static initializer
+ * as shown in the below example code.
+ *
+ * <!--
+ * The source code for the CompanySerializer class resides in
+ * tests/com/examples/ds/User.java
+ * Please keep the below code snippet in sync with that file.
+ * -->
+ *
+ * <PRE>
+public class User implements DataSerializable {
+ private String name;
+ private int userId;
+
+ static {
+ Instantiator.register(new Instantiator(User.class, 45) {
+ public DataSerializable newInstance() {
+ return new User();
+ }
+ });
+ }
+
+ public User(String name, int userId) {
+ this.name = name;
+ this.userId = userId;
+ }
+
+ /**
+ * Creates an "empty" User whose contents are filled in by
+ * invoking its toData() method
+ */
+ private User() {
+
+ }
+
+ public void toData(DataOutput out) throws IOException {
+ out.writeUTF(this.name);
+ out.writeInt(this.userId);
+ }
+
+ public void fromData(DataInput in)
+ throws IOException, ClassNotFoundException {
+ this.name = in.readUTF();
+ this.userId = in.readInt();
+ }
+}
+ * </PRE>
+ *
+ * <code>Instantiator</code>s may be distributed to other members of
+ * the distributed system when they are registered. Consider the
+ * following scenario in which VM1 and VM2 are members of the same
+ * distributed system. Both VMs define the sameRegion and VM2's
+ * region replicates the contents of VM1's using replication.
+ * VM1 puts an instance of the above <code>User</code> class into the
+ * region. The act of instantiating <code>User</code> will load the
+ * <code>User</code> class and invoke its static initializer, thus
+ * registering the <code>Instantiator</code> with the data
+ * serialization framework. Because the region is a replicate, the
+ * <code>User</code> will be data serialized and sent to VM2.
+ * However, when VM2 attempts to data deserialize the
+ * <code>User</code>, its <code>Instantiator</code> will not
+ * necessarily be registered because <code>User</code>'s static
+ * initializer may not have been invoked yet. As a result, an
+ * exception would be logged while deserializing the <code>User</code>
+ * and the replicate would not appear to have the new value. So, in
+ * order to ensure that the <code>Instantiator</code> is registered in
+ * VM2, the data serialization framework distributes a message to each
+ * member when an <code>Instantiator</code> is {@linkplain #register(Instantiator)
+ * registered}. <p>Note that the framework does not require that an
+ * <code>Instantiator</code> be {@link java.io.Serializable}, but it
+ * does require that it provide
+ * a {@linkplain #Instantiator(Class, int)
+ * two-argument constructor}.
+ *
+ * @see #register(Instantiator)
+ * @see #newInstance
+ *
+ * @author David Whitlock
+ * @since 3.5 */
+public abstract class Instantiator {
+
+ /** The class associated with this instantiator. Used mainly for
+ * debugging purposes and error messages. */
+ private Class<? extends DataSerializable> clazz;
+
+ /** The id of this <code>Instantiator</code> */
+ private int id;
+
+ /** The eventId of this <code>Instantiator</code> */
+ private EventID eventId;
+
+ /** The originator of this <code>Instantiator</code> */
+ private ClientProxyMembershipID context;
+
+
+ /////////////////////// Static Methods ///////////////////////
+
+ /**
+ * Registers a <code>DataSerializable</code> class with the data
+ * serialization framework. This method is usually invoked from the
+ * static initializer of a class that implements
+ * <code>DataSerializable</code>.
+ *
+ * @param instantiator
+ * An <code>Instantiator</code> whose {@link #newInstance}
+ * method is invoked when an object is data deserialized.
+ *
+ * @throws IllegalStateException
+ * If class <code>c</code> is
+ * already registered with a different class id, or another
+ * class has already been registered with id
+ * <code>classId</code>
+ * @throws NullPointerException
+ * If <code>instantiator</code> is <code>null</code>.
+ */
+ public static synchronized void register(Instantiator instantiator) {
+ InternalInstantiator.register(instantiator, true);
+ }
+
+ /**
+ * Registers a <code>DataSerializable</code> class with the data
+ * serialization framework. This method is usually invoked from the
+ * static initializer of a class that implements
+ * <code>DataSerializable</code>.
+ *
+ * @param instantiator
+ * An <code>Instantiator</code> whose {@link #newInstance}
+ * method is invoked when an object is data deserialized.
+ *
+ * @param distribute
+ * True if the registered <code>DataSerializer</code> has to be
+ * distributed to other members of the distributed system.
+ *
+ * @throws IllegalArgumentException
+ * If class <code>c</code> is
+ * already registered with a different class id, or another
+ * class has already been registered with id
+ * <code>classId</code>
+ * @throws NullPointerException
+ * If <code>instantiator</code> is <code>null</code>.
+ */
+ public static synchronized void register(Instantiator instantiator,
+ boolean distribute) {
+ InternalInstantiator.register(instantiator, distribute);
+ }
+
+ //////////////////////// Constructors ////////////////////////
+
+ /**
+ * Creates a new <code>Instantiator</code> that instantiates a given
+ * class.
+ *
+ * @param c
+ * The <code>DataSerializable</code> class to register. This
+ * class must have a static initializer that registers this
+ * <code>Instantiator</code>.
+ * @param classId
+ * A unique id for class <code>c</code>. The
+ * <code>classId</code> must not be zero.
+ * This has been an <code>int</code> since dsPhase1.
+ *
+ * @throws IllegalArgumentException
+ * If <code>c</code> does not implement
+ * <code>DataSerializable</code>, <code>classId</code> is
+ * less than or equal to zero.
+ * @throws NullPointerException
+ * If <code>c</code> is <code>null</code>
+ */
+ public Instantiator(Class<? extends DataSerializable> c, int classId) {
+ if (c == null) {
+ throw new NullPointerException(LocalizedStrings.Instantiator_CANNOT_REGISTER_A_NULL_CLASS.toLocalizedString());
+ }
+
+ if (!DataSerializable.class.isAssignableFrom(c)) {
+ throw new IllegalArgumentException(LocalizedStrings.Instantiator_CLASS_0_DOES_NOT_IMPLEMENT_DATASERIALIZABLE.toLocalizedString(c.getName()));
+ }
+
+ if (classId == 0) {
+ throw new IllegalArgumentException(LocalizedStrings.Instantiator_CLASS_ID_0_MUST_NOT_BE_0.toLocalizedString(Integer.valueOf(classId)));
+ }
+
+ this.clazz = c;
+ this.id = classId;
+ }
+
+ ////////////////////// Instance Methods //////////////////////
+
+ /**
+ * Creates a new "empty" instance of a <Code>DataSerializable</code>
+ * class whose state will be filled in by invoking its {@link
+ * DataSerializable#fromData fromData} method.
+ *
+ * @see DataSerializer#readObject
+ */
+ public abstract DataSerializable newInstance();
+
+ /**
+ * Returns the <code>DataSerializable</code> class that is
+ * instantiated by this <code>Instantiator</code>.
+ */
+ public final Class<? extends DataSerializable> getInstantiatedClass() {
+ return this.clazz;
+ }
+
+ /**
+ * Returns the unique <code>id</code> of this
+ * <code>Instantiator</code>.
+ */
+ public final int getId() {
+ return this.id;
+ }
+ /**
+ * sets the unique <code>eventId</code> of this
+ * <code>Instantiator</code>. For internal use only.
+ */
+ public final void setEventId(Object/*EventID*/ eventId) {
+ this.eventId = (EventID)eventId;
+ }
+
+ /**
+ * Returns the unique <code>eventId</code> of this
+ * <code>Instantiator</code>. For internal use only.
+ */
+ public final Object/*EventID*/ getEventId() {
+ return this.eventId;
+ }
+
+ /**
+ * sets the context of this
+ * <code>Instantiator</code>. For internal use only.
+ */
+ public final void setContext(Object/*ClientProxyMembershipID*/ context) {
+ this.context = (ClientProxyMembershipID)context;
+ }
+
+ /**
+ * Returns the context of this
+ * <code>Instantiator</code>. For internal use only.
+ */
+ public final Object/*ClientProxyMembershipID*/ getContext() {
+ return this.context;
+ }
+
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/19459053/gemfire-core/src/main/java/com/gemstone/gemfire/InternalGemFireError.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/InternalGemFireError.java b/gemfire-core/src/main/java/com/gemstone/gemfire/InternalGemFireError.java
new file mode 100644
index 0000000..3e13588
--- /dev/null
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/InternalGemFireError.java
@@ -0,0 +1,145 @@
+/*=========================================================================
+ * Copyright (c) 2010-2014 Pivotal Software, Inc. All Rights Reserved.
+ * This product is protected by U.S. and international copyright
+ * and intellectual property laws. Pivotal products are covered by
+ * one or more patents listed at http://www.pivotal.io/patents.
+ *=========================================================================
+ */
+/**
+ *
+ */
+package com.gemstone.gemfire;
+
+/**
+ * Indicates that serious error has occurred within the GemFire system.
+ *
+ * This is similar to {@link AssertionError}, but these errors are always
+ * enabled in a GemFire system.
+ *
+ * @author jpenney
+ * @since 5.5
+ * @see AssertionError
+ */
+public class InternalGemFireError extends Error {
+ private static final long serialVersionUID = 6390043490679349593L;
+
+ /**
+ *
+ */
+ public InternalGemFireError() {
+ // TODO Auto-generated constructor stub
+ }
+
+ /**
+ * @param message
+ */
+ public InternalGemFireError(String message) {
+ super(message);
+ }
+
+ /**
+ * @param cause
+ */
+ public InternalGemFireError(Throwable cause) {
+ super(cause);
+ }
+
+ /**
+ * @param message
+ * @param cause
+ */
+ public InternalGemFireError(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ /**
+ * Constructs an AssertionError with its detail message derived
+ * from the specified object, which is converted to a string as
+ * defined in <i>The Java Language Specification, Second
+ * Edition</i>, Section 15.18.1.1.
+ *<p>
+ * If the specified object is an instance of <tt>Throwable</tt>, it
+ * becomes the <i>cause</i> of the newly constructed assertion error.
+ *
+ * @param detailMessage value to be used in constructing detail message
+ * @see Throwable#getCause()
+ */
+ public InternalGemFireError(Object detailMessage) {
+ this("" + detailMessage);
+ if (detailMessage instanceof Throwable)
+ initCause((Throwable) detailMessage);
+ }
+
+ /**
+ * Constructs an AssertionError with its detail message derived
+ * from the specified <code>boolean</code>, which is converted to
+ * a string as defined in <i>The Java Language Specification,
+ * Second Edition</i>, Section 15.18.1.1.
+ *
+ * @param detailMessage value to be used in constructing detail message
+ */
+ public InternalGemFireError(boolean detailMessage) {
+ this("" + detailMessage);
+ }
+
+ /**
+ * Constructs an AssertionError with its detail message derived
+ * from the specified <code>char</code>, which is converted to a
+ * string as defined in <i>The Java Language Specification, Second
+ * Edition</i>, Section 15.18.1.1.
+ *
+ * @param detailMessage value to be used in constructing detail message
+ */
+ public InternalGemFireError(char detailMessage) {
+ this("" + detailMessage);
+ }
+
+ /**
+ * Constructs an AssertionError with its detail message derived
+ * from the specified <code>int</code>, which is converted to a
+ * string as defined in <i>The Java Language Specification, Second
+ * Edition</i>, Section 15.18.1.1.
+ *
+ * @param detailMessage value to be used in constructing detail message
+ */
+ public InternalGemFireError(int detailMessage) {
+ this("" + detailMessage);
+ }
+
+ /**
+ * Constructs an AssertionError with its detail message derived
+ * from the specified <code>long</code>, which is converted to a
+ * string as defined in <i>The Java Language Specification, Second
+ * Edition</i>, Section 15.18.1.1.
+ *
+ * @param detailMessage value to be used in constructing detail message
+ */
+ public InternalGemFireError(long detailMessage) {
+ this("" + detailMessage);
+ }
+
+ /**
+ * Constructs an AssertionError with its detail message derived
+ * from the specified <code>float</code>, which is converted to a
+ * string as defined in <i>The Java Language Specification, Second
+ * Edition</i>, Section 15.18.1.1.
+ *
+ * @param detailMessage value to be used in constructing detail message
+ */
+ public InternalGemFireError(float detailMessage) {
+ this("" + detailMessage);
+ }
+
+ /**
+ * Constructs an AssertionError with its detail message derived
+ * from the specified <code>double</code>, which is converted to a
+ * string as defined in <i>The Java Language Specification, Second
+ * Edition</i>, Section 15.18.1.1.
+ *
+ * @param detailMessage value to be used in constructing detail message
+ */
+ public InternalGemFireError(double detailMessage) {
+ this("" + detailMessage);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/19459053/gemfire-core/src/main/java/com/gemstone/gemfire/InternalGemFireException.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/InternalGemFireException.java b/gemfire-core/src/main/java/com/gemstone/gemfire/InternalGemFireException.java
new file mode 100644
index 0000000..ddea8b9
--- /dev/null
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/InternalGemFireException.java
@@ -0,0 +1,47 @@
+/*=========================================================================
+ * Copyright (c) 2002-2014 Pivotal Software, Inc. All Rights Reserved.
+ * This product is protected by U.S. and international copyright
+ * and intellectual property laws. Pivotal products are covered by
+ * more patents listed at http://www.pivotal.io/patents.
+ *========================================================================
+ */
+
+package com.gemstone.gemfire;
+
+/**
+ * An <code>InternalGemFireException</code> is thrown when
+ * a low level, internal, operation fails due to no fault of
+ * the user. The message often contains an operating system
+ * error code.
+ *
+ * @author David Whitlock
+ *
+ */
+public class InternalGemFireException extends GemFireException {
+private static final long serialVersionUID = -6912843691545178619L;
+
+ ////////////////////// Constructors //////////////////////
+
+ public InternalGemFireException() {
+ super();
+ }
+
+ public InternalGemFireException(Throwable cause) {
+ super(cause);
+ }
+
+ /**
+ * Creates a new <code>InternalGemFireException</code>.
+ */
+ public InternalGemFireException(String message) {
+ super(message);
+ }
+
+ /**
+ * Creates a new <code>InternalGemFireException</code> that was
+ * caused by a given exception
+ */
+ public InternalGemFireException(String message, Throwable thr) {
+ super(message, thr);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/19459053/gemfire-core/src/main/java/com/gemstone/gemfire/InvalidDeltaException.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/InvalidDeltaException.java b/gemfire-core/src/main/java/com/gemstone/gemfire/InvalidDeltaException.java
new file mode 100755
index 0000000..3f191c2
--- /dev/null
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/InvalidDeltaException.java
@@ -0,0 +1,54 @@
+/*=========================================================================
+ * Copyright (c) 2010-2014 Pivotal Software, Inc. All Rights Reserved.
+ * This product is protected by U.S. and international copyright
+ * and intellectual property laws. Pivotal products are covered by
+ * one or more patents listed at http://www.pivotal.io/patents.
+ *=========================================================================
+ */
+package com.gemstone.gemfire;
+
+import java.io.DataInput;
+
+/**
+ * An <code>InvalidDeltaException</code> is thrown when a delta cannot be
+ * successfully applied by the receiving peer/client. The class implementing
+ * {@link Delta} may also choose to throw this in
+ * {@link Delta#fromDelta(DataInput in)}. GemFire, on encountering this
+ * exception distributes the full application object.
+ *
+ * @since 6.1
+ */
+public class InvalidDeltaException extends GemFireException {
+
+ /**
+ * Creates a new <code>InvalidDeltaException</code>.
+ */
+ public InvalidDeltaException() {
+ }
+
+ /**
+ * Creates a new <code>InvalidDeltaException</code>.
+ * @param msg String explaining the exception
+ */
+ public InvalidDeltaException(String msg) {
+ super(msg);
+ }
+
+ /**
+ * Creates a new <code>InvalidDeltaException</code>.
+ * @param e Throwable
+ */
+ public InvalidDeltaException(Throwable e) {
+ super(e);
+ }
+
+ /**
+ * Creates a new <code>InvalidDeltaException</code>.
+ * @param msg String explaining the exception
+ * @param e Throwable
+ */
+ public InvalidDeltaException(String msg, Throwable e) {
+ super(msg, e);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/19459053/gemfire-core/src/main/java/com/gemstone/gemfire/InvalidValueException.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/InvalidValueException.java b/gemfire-core/src/main/java/com/gemstone/gemfire/InvalidValueException.java
new file mode 100644
index 0000000..0e6ac8a
--- /dev/null
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/InvalidValueException.java
@@ -0,0 +1,33 @@
+/*=========================================================================
+ * Copyright (c) 2002-2014 Pivotal Software, Inc. All Rights Reserved.
+ * This product is protected by U.S. and international copyright
+ * and intellectual property laws. Pivotal products are covered by
+ * more patents listed at http://www.pivotal.io/patents.
+ *========================================================================
+ */
+package com.gemstone.gemfire;
+
+/**
+ * An <code>InvalidValueException</code> is thrown when an attempt is
+ * made to set a configuration attribute to an invalid value is made.
+ * Values are considered invalid when they are
+ * not compatible with the attribute's type.
+ */
+public class InvalidValueException extends GemFireException {
+private static final long serialVersionUID = 6186767885369527709L;
+
+ ////////////////////// Constructors //////////////////////
+
+ /**
+ * Creates a new <code>InvalidValueException</code>.
+ */
+ public InvalidValueException(String message) {
+ super(message);
+ }
+ /**
+ * Creates a new <code>InvalidValueException</code>.
+ */
+ public InvalidValueException(String message, Throwable ex) {
+ super(message, ex);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/19459053/gemfire-core/src/main/java/com/gemstone/gemfire/InvalidVersionException.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/InvalidVersionException.java b/gemfire-core/src/main/java/com/gemstone/gemfire/InvalidVersionException.java
new file mode 100644
index 0000000..c2d1ddd
--- /dev/null
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/InvalidVersionException.java
@@ -0,0 +1,9 @@
+package com.gemstone.gemfire;
+
+public class InvalidVersionException extends GemFireException {
+ private static final long serialVersionUID = 6342040462194322698L;
+
+ public InvalidVersionException(String msg) {
+ super(msg);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/19459053/gemfire-core/src/main/java/com/gemstone/gemfire/LicenseException.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/LicenseException.java b/gemfire-core/src/main/java/com/gemstone/gemfire/LicenseException.java
new file mode 100644
index 0000000..527c9b7
--- /dev/null
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/LicenseException.java
@@ -0,0 +1,45 @@
+/*=========================================================================
+ * Copyright (c) 2002-2014 Pivotal Software, Inc. All Rights Reserved.
+ * This product is protected by U.S. and international copyright
+ * and intellectual property laws. Pivotal products are covered by
+ * more patents listed at http://www.pivotal.io/patents.
+ *========================================================================
+ */
+
+package com.gemstone.gemfire;
+
+/**
+ * A <code>LicenseException</code> is thrown when
+ * the license check fails.
+ *
+ * @deprecated Licensing is not supported as of 8.0.
+ */
+@Deprecated
+public class LicenseException extends GemFireException {
+private static final long serialVersionUID = -1178557127300465801L;
+
+ ////////////////////// Constructors //////////////////////
+
+ /**
+ * Creates a new <code>LicenseException</code>.
+ */
+ public LicenseException(String message) {
+ super(message);
+ }
+
+ /**
+ * Creates a new <code>LicenseException</code> that was
+ * caused by a given exception
+ */
+ public LicenseException(String message, Throwable thr) {
+ super(message, thr);
+ }
+
+ /**
+ * Creates a new <code>LicenseException</code> that was
+ * caused by a given exception
+ */
+ public LicenseException(Throwable thr) {
+ super(thr.getMessage(), thr);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/19459053/gemfire-core/src/main/java/com/gemstone/gemfire/LogWriter.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/LogWriter.java b/gemfire-core/src/main/java/com/gemstone/gemfire/LogWriter.java
new file mode 100644
index 0000000..0555b75
--- /dev/null
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/LogWriter.java
@@ -0,0 +1,292 @@
+/*=========================================================================
+ * Copyright (c) 2002-2014 Pivotal Software, Inc. All Rights Reserved.
+ * This product is protected by U.S. and international copyright
+ * and intellectual property laws. Pivotal products are covered by
+ * more patents listed at http://www.pivotal.io/patents.
+ *=========================================================================
+ */
+
+package com.gemstone.gemfire;
+
+import java.util.logging.Handler;
+
+import com.gemstone.gemfire.distributed.DistributedSystem;
+import com.gemstone.gemfire.i18n.LogWriterI18n;
+
+/**
+ * Defines methods available to clients that want to write a log message
+ * to their GemFire distributed system log file.
+ * <p>
+ * Instances of this interface can be obtained by calling
+ * {@link DistributedSystem#getLogWriter}.
+ * <p>
+ * For any logged message the log file will contain:
+ * <ul>
+ * <li> The message's level.
+ * <li> The time the message was logged.
+ * <li> The id of the thread that logged the message.
+ * <li> The message itself which can be a string and/or an exception
+ * including the exception's stack trace.
+ * </ul>
+ * <p>
+ * A message always has a level.
+ * Logging levels are ordered. Enabling logging at a given level also
+ * enables logging at higher levels. The higher the level the more
+ * important and urgent the message.
+ * <p>
+ * The levels, in descending order, are:
+ * <ul>
+ * <li> <code>severe</code> (highest value) is a message level indicating a serious failure.
+ * In general <code>severe</code> messages should describe events that
+ * are of considerable importance and which will prevent normal program
+ * execution. They should be reasonably intelligible to end users and
+ * to information managers.
+ * <li> <code>error</code>
+ * In general <code>error</code> messages should describe events that
+ * are of considerable importance but will not prevent normal program
+ * execution. They should be reasonably intelligible to end users and
+ * to information managers. They are weaker than <code>severe</code> and
+ * stronger than <code>warning</code>.
+ * <li> <code>warning</code> is a message level indicating a potential problem.
+ * In general <code>warning</code> messages should describe events that
+ * will be of interest to end users or information managers, or which indicate
+ * potential problems.
+ * <li> <code>info</code> is a message level for informational messages.
+ * Typically <code>info</code> messages should be reasonably significant
+ * and should make sense to end users and system administrators.
+ * <li> <code>config</code> is a message level for static configuration messages.
+ * <code>config</code> messages are intended to provide a variety of static
+ * configuration information, to assist in debugging problems that may be
+ * associated with particular configurations.
+ * <li> <code>fine</code> is a message level providing tracing information.
+ * In general the <code>fine</code> level should be used for information
+ * that will be broadly interesting to developers. This level is for
+ * the lowest volume, and most important, tracing messages.
+ * <li> <code>finer</code> indicates a fairly detailed tracing message.
+ * Logging calls for entering, returning, or throwing an exception
+ * are traced at the <code>finer</code> level.
+ * <li> <code>finest</code> (lowest value) indicates a highly detailed tracing message.
+ * In general the <code>finest</code> level should be used for the most
+ * voluminous detailed tracing messages.
+ * </ul>
+ * <p>
+ * For each level methods exist that will request a message, at that
+ * level, to be logged. These methods are all named after their level.
+ * <p>
+ * For each level a method exists that returns a boolean indicating
+ * if messages at that level will currently be logged. The names
+ * of these methods are of the form: <em>level</em><code>Enabled</code>.
+ *
+ * @author darrel
+ */
+public interface LogWriter {
+
+ /**
+ * Returns true if "severe" log messages are enabled.
+ * Returns false if "severe" log messages are disabled.
+ */
+ public boolean severeEnabled();
+ /**
+ * Writes both a message and exception to this writer.
+ * The message level is "severe".
+ */
+ public void severe(String msg, Throwable ex);
+ /**
+ * Writes a message to this writer.
+ * The message level is "severe".
+ */
+ public void severe(String msg);
+ /**
+ * Writes an exception to this writer.
+ * The exception level is "severe".
+ */
+ public void severe(Throwable ex);
+ /**
+ * Returns true if "error" log messages are enabled.
+ * Returns false if "error" log messages are disabled.
+ */
+ public boolean errorEnabled();
+ /**
+ * Writes both a message and exception to this writer.
+ * The message level is "error".
+ */
+ public void error(String msg, Throwable ex);
+ /**
+ * Writes a message to this writer.
+ * The message level is "error".
+ */
+ public void error(String msg);
+ /**
+ * Writes an exception to this writer.
+ * The exception level is "error".
+ */
+ public void error(Throwable ex);
+ /**
+ * Returns true if "warning" log messages are enabled.
+ * Returns false if "warning" log messages are disabled.
+ */
+ public boolean warningEnabled();
+ /**
+ * Writes both a message and exception to this writer.
+ * The message level is "warning".
+ */
+ public void warning(String msg, Throwable ex);
+ /**
+ * Writes a message to this writer.
+ * The message level is "warning".
+ */
+ public void warning(String msg);
+ /**
+ * Writes an exception to this writer.
+ * The exception level is "warning".
+ */
+ public void warning(Throwable ex);
+ /**
+ * Returns true if "info" log messages are enabled.
+ * Returns false if "info" log messages are disabled.
+ */
+ public boolean infoEnabled();
+ /**
+ * Writes both a message and exception to this writer.
+ * The message level is "information".
+ */
+ public void info(String msg, Throwable ex);
+ /**
+ * Writes a message to this writer.
+ * The message level is "information".
+ */
+ public void info(String msg);
+ /**
+ * Writes an exception to this writer.
+ * The exception level is "information".
+ */
+ public void info(Throwable ex);
+ /**
+ * Returns true if "config" log messages are enabled.
+ * Returns false if "config" log messages are disabled.
+ */
+ public boolean configEnabled();
+ /**
+ * Writes both a message and exception to this writer.
+ * The message level is "config".
+ */
+ public void config(String msg, Throwable ex);
+ /**
+ * Writes a message to this writer.
+ * The message level is "config".
+ */
+ public void config(String msg);
+ /**
+ * Writes an exception to this writer.
+ * The exception level is "config".
+ */
+ public void config(Throwable ex);
+ /**
+ * Returns true if "fine" log messages are enabled.
+ * Returns false if "fine" log messages are disabled.
+ */
+ public boolean fineEnabled();
+ /**
+ * Writes both a message and exception to this writer.
+ * The message level is "fine".
+ */
+ public void fine(String msg, Throwable ex);
+ /**
+ * Writes a message to this writer.
+ * The message level is "fine".
+ */
+ public void fine(String msg);
+ /**
+ * Writes an exception to this writer.
+ * The exception level is "fine".
+ */
+ public void fine(Throwable ex);
+ /**
+ * Returns true if "finer" log messages are enabled.
+ * Returns false if "finer" log messages are disabled.
+ */
+ public boolean finerEnabled();
+ /**
+ * Writes both a message and exception to this writer.
+ * The message level is "finer".
+ */
+ public void finer(String msg, Throwable ex);
+ /**
+ * Writes a message to this writer.
+ * The message level is "finer".
+ */
+ public void finer(String msg);
+ /**
+ * Writes an exception to this writer.
+ * The exception level is "finer".
+ */
+ public void finer(Throwable ex);
+ /**
+ * Log a method entry.
+ * <p>The logging is done using the <code>finer</code> level.
+ * The string message will start with <code>"ENTRY"</code> and
+ * include the class and method names.
+ * @param sourceClass Name of class that issued the logging request.
+ * @param sourceMethod Name of the method that issued the logging request.
+ */
+ public void entering(String sourceClass, String sourceMethod);
+ /**
+ * Log a method return.
+ * <p>The logging is done using the <code>finer</code> level.
+ * The string message will start with <code>"RETURN"</code> and
+ * include the class and method names.
+ * @param sourceClass Name of class that issued the logging request.
+ * @param sourceMethod Name of the method that issued the logging request.
+ */
+ public void exiting(String sourceClass, String sourceMethod);
+ /**
+ * Log throwing an exception.
+ * <p> Use to log that a method is
+ * terminating by throwing an exception. The logging is done using
+ * the <code>finer</code> level.
+ * <p> This is a convenience method that could be done
+ * instead by calling {@link #finer(String, Throwable)}.
+ * The string message will start with <code>"THROW"</code> and
+ * include the class and method names.
+ * @param sourceClass Name of class that issued the logging request.
+ * @param sourceMethod Name of the method that issued the logging request.
+ * @param thrown The Throwable that is being thrown.
+ */
+ public void throwing(String sourceClass, String sourceMethod,
+ Throwable thrown);
+ /**
+ * Returns true if "finest" log messages are enabled.
+ * Returns false if "finest" log messages are disabled.
+ */
+ public boolean finestEnabled();
+ /**
+ * Writes both a message and exception to this writer.
+ * The message level is "finest".
+ */
+ public void finest(String msg, Throwable ex);
+ /**
+ * Writes a message to this writer.
+ * The message level is "finest".
+ */
+ public void finest(String msg);
+ /**
+ * Writes an exception to this writer.
+ * The exception level is "finest".
+ */
+ public void finest(Throwable ex);
+
+ /**
+ * Returns a 1.4 logging handler that can be used to direct application
+ * output to this GemFire logger using the standard JDK logger APIs.
+ * Each time this method is called it creates a new instance of a
+ * Handler so care should be taken to not call this method too often.
+ */
+ public Handler getHandler();
+
+ /**
+ * A mechanism for accessing the abstraction layer used for
+ * internationalization.
+ * @return LogWriterI18n
+ */
+ public LogWriterI18n convertToLogWriterI18n();
+}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/19459053/gemfire-core/src/main/java/com/gemstone/gemfire/NoSystemException.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/NoSystemException.java b/gemfire-core/src/main/java/com/gemstone/gemfire/NoSystemException.java
new file mode 100644
index 0000000..3dd292c
--- /dev/null
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/NoSystemException.java
@@ -0,0 +1,39 @@
+/*=========================================================================
+ * Copyright (c) 2002-2014 Pivotal Software, Inc. All Rights Reserved.
+ * This product is protected by U.S. and international copyright
+ * and intellectual property laws. Pivotal products are covered by
+ * more patents listed at http://www.pivotal.io/patents.
+ *========================================================================
+ */
+package com.gemstone.gemfire;
+
+/**
+ * A <code>NoSystemException</code> is thrown when a
+ * locator can not be found or connected to.
+ * In most cases one of the following subclasses is used instead
+ * of <code>NoSystemException</code>:
+ * <ul>
+ * <li> {@link UncreatedSystemException}
+ * <li> {@link UnstartedSystemException}
+ * </ul>
+ * <p>As of GemFire 5.0 this exception should be named NoLocatorException.
+ */
+public class NoSystemException extends GemFireException {
+private static final long serialVersionUID = -101890149467219630L;
+
+ ////////////////////// Constructors //////////////////////
+
+ /**
+ * Creates a new <code>NoSystemException</code>.
+ */
+ public NoSystemException(String message) {
+ super(message);
+ }
+ /**
+ * Creates a new <code>NoSystemException</code> with the given message
+ * and cause.
+ */
+ public NoSystemException(String message, Throwable cause) {
+ super(message, cause);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/19459053/gemfire-core/src/main/java/com/gemstone/gemfire/SerializationException.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/SerializationException.java b/gemfire-core/src/main/java/com/gemstone/gemfire/SerializationException.java
new file mode 100644
index 0000000..fd95e5d
--- /dev/null
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/SerializationException.java
@@ -0,0 +1,36 @@
+/*=========================================================================
+ * Copyright (c) 2002-2014 Pivotal Software, Inc. All Rights Reserved.
+ * This product is protected by U.S. and international copyright
+ * and intellectual property laws. Pivotal products are covered by
+ * more patents listed at http://www.pivotal.io/patents.
+ *=========================================================================
+ */
+package com.gemstone.gemfire;
+
+import com.gemstone.gemfire.GemFireIOException;
+
+/**
+ * An exception indicating that a serialization or deserialization failed.
+ * @author darrel
+ * @since 5.7
+ */
+public class SerializationException extends GemFireIOException {
+private static final long serialVersionUID = 7783018024920098997L;
+ /**
+ *
+ * Create a new instance of SerializationException with a detail message
+ * @param message the detail message
+ */
+ public SerializationException(String message) {
+ super(message);
+ }
+
+ /**
+ * Create a new instance of SerializationException with a detail message and cause
+ * @param message the detail message
+ * @param cause the cause
+ */
+ public SerializationException(String message, Throwable cause) {
+ super(message, cause);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/19459053/gemfire-core/src/main/java/com/gemstone/gemfire/StatisticDescriptor.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/StatisticDescriptor.java b/gemfire-core/src/main/java/com/gemstone/gemfire/StatisticDescriptor.java
new file mode 100644
index 0000000..38b0129
--- /dev/null
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/StatisticDescriptor.java
@@ -0,0 +1,73 @@
+/*=========================================================================
+ * Copyright (c) 2010-2014 Pivotal Software, Inc. All Rights Reserved.
+ * This product is protected by U.S. and international copyright
+ * and intellectual property laws. Pivotal products are covered by
+ * one or more patents listed at http://www.pivotal.io/patents.
+ *=========================================================================
+ */
+package com.gemstone.gemfire;
+
+//import com.gemstone.gemfire.internal.Assert;
+//import com.gemstone.gemfire.internal.FieldInfo;
+
+/**
+ * Describes an individual statistic whose value is updated by an
+ * application and may be archived by GemFire. These descriptions are
+ * gathered together in a {@link StatisticsType}.
+ *
+ * <P>
+ * To get an instance of this interface use an instance of
+ * {@link StatisticsFactory}.
+ * <P>
+ * <code>StatisticDescriptor</code>s are naturally ordered by their name.
+ *
+ * @author David Whitlock
+ * @author Darrel Schneider
+ *
+ * @since 3.0
+ */
+public interface StatisticDescriptor extends Comparable<StatisticDescriptor> {
+
+ //////////////////// Instance Methods ////////////////////
+
+ /**
+ * Returns the id of this statistic in a {@link StatisticsType
+ * statistics type}. The id is initialized when its statistics
+ * type is created.
+ *
+ * @throws IllegalStateException
+ * The id has not been initialized yet
+ */
+ public int getId();
+
+ /**
+ * Returns the name of this statistic
+ */
+ public String getName();
+
+ /**
+ * Returns a description of this statistic
+ */
+ public String getDescription();
+
+ /**
+ * Returns the type of this statistic
+ */
+ public Class<?> getType();
+
+ /**
+ * Returns true if this statistic is a counter; false if its a gauge.
+ * Counter statistics have values that always increase.
+ * Gauge statistics have unconstrained values.
+ */
+ public boolean isCounter();
+
+ /**
+ * Returns true if a larger statistic value indicates better performance.
+ */
+ public boolean isLargerBetter();
+ /**
+ * Returns the unit in which this statistic is measured
+ */
+ public String getUnit();
+}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/19459053/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
new file mode 100644
index 0000000..3b74113
--- /dev/null
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/Statistics.java
@@ -0,0 +1,437 @@
+/*=========================================================================
+ * Copyright (c) 2010-2014 Pivotal Software, Inc. All Rights Reserved.
+ * This product is protected by U.S. and international copyright
+ * and intellectual property laws. Pivotal products are covered by
+ * one or more patents listed at http://www.pivotal.io/patents.
+ *=========================================================================
+ */
+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/19459053/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
new file mode 100644
index 0000000..3e239a0
--- /dev/null
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/StatisticsFactory.java
@@ -0,0 +1,145 @@
+/*=========================================================================
+ * Copyright (c) 2010-2014 Pivotal Software, Inc. All Rights Reserved.
+ * This product is protected by U.S. and international copyright
+ * and intellectual property laws. Pivotal products are covered by
+ * one or more patents listed at http://www.pivotal.io/patents.
+ *=========================================================================
+ */
+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);
+}