geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kl...@apache.org
Subject [35/52] [partial] incubator-geode git commit: Added Spotless plugin to enforce formatting standards. Added Google Java Style guide formatter templates, removed existing formatter templates.
Date Wed, 26 Oct 2016 21:22:52 GMT
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8bf39571/geode-core/src/main/java/org/apache/geode/CancelCriterion.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/CancelCriterion.java b/geode-core/src/main/java/org/apache/geode/CancelCriterion.java
index f0eb160..e4f9a41 100644
--- a/geode-core/src/main/java/org/apache/geode/CancelCriterion.java
+++ b/geode-core/src/main/java/org/apache/geode/CancelCriterion.java
@@ -1,32 +1,29 @@
 /*
- * 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
+ * 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
+ * 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.
+ * 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 org.apache.geode;
 
 /**
  * Abstract cancellation proxy for cancelling an operation, esp. a thread.
  * 
- * Creators of services or threads should implement a subclass of CancelCriterion,
- * and implement the two methods - cancelInProgress, and generateCancelledException(e).
+ * Creators of services or threads should implement a subclass of CancelCriterion, and implement
the
+ * two methods - cancelInProgress, and generateCancelledException(e).
  * 
  * Code inside the service can check to see if the service is cancelled by calling
- * {@link #checkCancelInProgress(Throwable)}. Generally the pattern is to check
- * before performing an operation, check if the service is canceled before propgrating 
- * an exception futher up the stack, and check for cancelation inside a long loop.
- * Eg.
+ * {@link #checkCancelInProgress(Throwable)}. Generally the pattern is to check before performing
an
+ * operation, check if the service is canceled before propgrating an exception futher up
the stack,
+ * and check for cancelation inside a long loop. Eg.
  * 
  * <code>
  * while(true) {
@@ -43,25 +40,25 @@ package org.apache.geode;
  * @see CancelException
  * @since GemFire 5.1
  */
-public abstract class CancelCriterion
-{
-  
+public abstract class CancelCriterion {
+
   /**
-   * Indicate if the service is in the progress of being cancelled.  The
-   * typical use of this is to indicate, in the case of an {@link InterruptedException},
-   * that the current operation should be cancelled.
-   * @return null if the service is not shutting down, or a message that can be used to
-   * construct an exception indicating the service is shut down.
+   * Indicate if the service is in the progress of being cancelled. The typical use of this
is to
+   * indicate, in the case of an {@link InterruptedException}, that the current operation
should be
+   * cancelled.
+   * 
+   * @return null if the service is not shutting down, or a message that can be used to construct
an
+   *         exception indicating the service is shut down.
    */
   public abstract String cancelInProgress();
-//import org.apache.geode.distributed.internal.DistributionManager;
-//    * <p>
-//    * In particular, a {@link DistributionManager} returns a non-null result if
-//    * message distribution has been terminated.
-  
+  // import org.apache.geode.distributed.internal.DistributionManager;
+  // * <p>
+  // * In particular, a {@link DistributionManager} returns a non-null result if
+  // * message distribution has been terminated.
+
   /**
-   * Use this utility  function in your implementation of cancelInProgress()
-   * and cancelled() to indicate a system failure
+   * Use this utility function in your implementation of cancelInProgress() and cancelled()
to
+   * indicate a system failure
    * 
    * @return failure string if system failure has occurred
    */
@@ -75,11 +72,10 @@ public abstract class CancelCriterion
   }
 
   /**
-   * See if the current operation is being cancelled.  If so, it either
-   * throws a {@link RuntimeException} (usually a {@link CancelException}).
+   * See if the current operation is being cancelled. If so, it either throws a
+   * {@link RuntimeException} (usually a {@link CancelException}).
    * 
-   * @param e an underlying exception or null if there is no exception 
-   * that triggered this check
+   * @param e an underlying exception or null if there is no exception that triggered this
check
    * @see #cancelInProgress()
    */
   public final void checkCancelInProgress(Throwable e) {
@@ -93,23 +89,21 @@ public abstract class CancelCriterion
 
   /**
    * Template factory method for generating the exception to be thrown by
-   * {@link #checkCancelInProgress(Throwable)}. Override this to specify
-   * different exception for checkCancelInProgress() to throw.
+   * {@link #checkCancelInProgress(Throwable)}. Override this to specify different exception
for
+   * checkCancelInProgress() to throw.
    * 
-   * This method should wrap the exception in a service specific 
-   * CancelationException (eg CacheClosedException). 
-   * or return null if the service is not being canceled.
+   * This method should wrap the exception in a service specific CancelationException (eg
+   * CacheClosedException). or return null if the service is not being canceled.
    * 
-   * @param e
-   *          an underlying exception, if any
-   * @return RuntimeException to be thrown by checkCancelInProgress(), null if
-   *         the receiver has not been cancelled.
+   * @param e an underlying exception, if any
+   * @return RuntimeException to be thrown by checkCancelInProgress(), null if the receiver
has not
+   *         been cancelled.
    */
   abstract public RuntimeException generateCancelledException(Throwable e);
 
   /**
-   * Checks to see if a cancellation is in progress.  This is equivalent to
-   * the expression (cancelInProgress() != null).
+   * Checks to see if a cancellation is in progress. This is equivalent to the expression
+   * (cancelInProgress() != null).
    * 
    * @return true if a cancellation is in progress, false if not
    */

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8bf39571/geode-core/src/main/java/org/apache/geode/CancelException.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/CancelException.java b/geode-core/src/main/java/org/apache/geode/CancelException.java
index 422036a..49413f2 100644
--- a/geode-core/src/main/java/org/apache/geode/CancelException.java
+++ b/geode-core/src/main/java/org/apache/geode/CancelException.java
@@ -1,18 +1,16 @@
 /*
- * 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
+ * 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
+ * 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.
+ * 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.
  */
 /**
  * 
@@ -22,8 +20,7 @@ package org.apache.geode;
 import org.apache.geode.cache.CacheRuntimeException;
 
 /**
- * Abstract root class of all GemFire exceptions representing system
- * cancellation
+ * Abstract root class of all GemFire exceptions representing system cancellation
  * 
  * @since GemFire 6.0
  */
@@ -33,11 +30,11 @@ public abstract class CancelException extends CacheRuntimeException {
   /**
    * for serialization
    */
-  public CancelException() {
-  }
+  public CancelException() {}
 
   /**
    * Create instance with given message
+   * 
    * @param message the message
    */
   public CancelException(String message) {
@@ -46,6 +43,7 @@ public abstract class CancelException extends CacheRuntimeException {
 
   /**
    * Create instance with given message and cause
+   * 
    * @param message the message
    * @param cause the cause
    */
@@ -55,6 +53,7 @@ public abstract class CancelException extends CacheRuntimeException {
 
   /**
    * Create instance with empty message and given cause
+   * 
    * @param cause the cause
    */
   public CancelException(Throwable cause) {

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8bf39571/geode-core/src/main/java/org/apache/geode/CanonicalInstantiator.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/CanonicalInstantiator.java b/geode-core/src/main/java/org/apache/geode/CanonicalInstantiator.java
index d62d873..10e6f16 100644
--- a/geode-core/src/main/java/org/apache/geode/CanonicalInstantiator.java
+++ b/geode-core/src/main/java/org/apache/geode/CanonicalInstantiator.java
@@ -1,69 +1,55 @@
 /*
- * 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
+ * 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
+ * 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.
+ * 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 org.apache.geode;
 
 import java.io.*;
 
 /**
- * <code>CanonicalInstantiator</code> is much like its parent
- * <code>Instantiator</code> except that instead of
- * needing to implement <code>newInstance()</code>
- * you now must implement <code>newInstance(DataInput)</code>.
- * The addition of the <code>DataInput</code> parameter allows the instance
- * creator to optionally read data from the data input stream and use it to
- * decide the instance to create. This allows a value that represents a
- * canonical instance to be written by a class's {@link DataSerializer#toData}
- * and then be read by <code>newInstance(DataInput)</code>
- * and map it back to a canonical instance.
+ * <code>CanonicalInstantiator</code> is much like its parent <code>Instantiator</code>
except that
+ * instead of needing to implement <code>newInstance()</code> you now must implement
+ * <code>newInstance(DataInput)</code>. The addition of the <code>DataInput</code>
parameter allows
+ * the instance creator to optionally read data from the data input stream and use it to
decide the
+ * instance to create. This allows a value that represents a canonical instance to be written
by a
+ * class's {@link DataSerializer#toData} and then be read by <code>newInstance(DataInput)</code>
and
+ * map it back to a canonical instance.
  * <p>
- * Note that {@link DataSerializer#fromData} is always called on the instance
- * returned from <code>newInstance(DataInput)</code>.
+ * Note that {@link DataSerializer#fromData} is always called on the instance returned from
+ * <code>newInstance(DataInput)</code>.
  *
  * @since GemFire 5.1
  */
 public abstract class CanonicalInstantiator extends Instantiator {
   /**
-   * Creates a new <code>CanonicalInstantiator</code> that instantiates a given
-   * class.
+   * Creates a new <code>CanonicalInstantiator</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.
+   * @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>
+   * @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 CanonicalInstantiator(Class<? extends DataSerializable> c, int classId) {
     super(c, classId);
   }
-  
+
   /**
-   * This method is not supported and if called will
-   * throw UnsupportedOperationException.
-   * Use {@link #newInstance(DataInput)} instead.
+   * This method is not supported and if called will throw UnsupportedOperationException.
Use
+   * {@link #newInstance(DataInput)} instead.
    * 
    * @throws UnsupportedOperationException in all cases
    */
@@ -71,15 +57,15 @@ public abstract class CanonicalInstantiator extends Instantiator {
   public final DataSerializable newInstance() {
     throw new UnsupportedOperationException();
   }
+
   /**
-   * 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.
+   * 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.
+   * 
    * @param in the data input that can be read to decide what instance to create.
    * @return the new "empty" instance.
    * @throws IOException if a read from <code>in</code> fails.
    * @since GemFire 5.1
    */
-  public abstract DataSerializable newInstance(DataInput in)
-    throws IOException;
+  public abstract DataSerializable newInstance(DataInput in) throws IOException;
 }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8bf39571/geode-core/src/main/java/org/apache/geode/CopyException.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/CopyException.java b/geode-core/src/main/java/org/apache/geode/CopyException.java
index 8ad9c57..00ad5da 100644
--- a/geode-core/src/main/java/org/apache/geode/CopyException.java
+++ b/geode-core/src/main/java/org/apache/geode/CopyException.java
@@ -1,18 +1,16 @@
 /*
- * 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
+ * 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
+ * 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.
+ * 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 org.apache.geode;
 
@@ -25,15 +23,15 @@ package org.apache.geode;
  * @since GemFire 4.0
  */
 public class CopyException extends GemFireException {
-private static final long serialVersionUID = -1143711608610323585L;
-  
+  private static final long serialVersionUID = -1143711608610323585L;
+
   /**
    * Constructs a new <code>CopyException</code>.
    */
   public CopyException() {
     super();
   }
-  
+
   /**
    * Constructs a new <code>CopyException</code> with a message string.
    *
@@ -42,10 +40,9 @@ private static final long serialVersionUID = -1143711608610323585L;
   public CopyException(String msg) {
     super(msg);
   }
-  
+
   /**
-   * Constructs a new <code>CopyException</code> with a message string
-   * and a cause.
+   * Constructs a new <code>CopyException</code> with a message string and a
cause.
    *
    * @param msg the message string
    * @param cause a causal Throwable
@@ -53,7 +50,7 @@ private static final long serialVersionUID = -1143711608610323585L;
   public CopyException(String msg, Throwable cause) {
     super(msg, cause);
   }
-  
+
   /**
    * Constructs a new <code>CopyException</code> with a cause.
    *

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8bf39571/geode-core/src/main/java/org/apache/geode/CopyHelper.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/CopyHelper.java b/geode-core/src/main/java/org/apache/geode/CopyHelper.java
index dd79c0e..86592c0 100644
--- a/geode-core/src/main/java/org/apache/geode/CopyHelper.java
+++ b/geode-core/src/main/java/org/apache/geode/CopyHelper.java
@@ -1,20 +1,19 @@
 /*
- * 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
+ * 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
+ * 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.
+ * 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 org.apache.geode;
+
 import java.io.DataInputStream;
 import java.io.IOException;
 import java.io.Serializable;
@@ -35,19 +34,19 @@ import org.apache.geode.pdx.WritablePdxInstance;
 import org.apache.geode.pdx.internal.PdxUnreadData;
 
 /**
- * A static helper for optimally creating copies.  Creating copies
- * of cache values provides improved concurrency as well as isolation.
- * For transactions, creating a copy is the guaranteed way to enforce
- * "Read Committed" isolation on changes to cache
- * <code>Entries</code>.
-
- * <p>Here is a simple example of how to use <code>CopyHelper.copy</code>
- *  <pre>
- *    Object o = r.get("stringBuf");
- *    StringBuffer s = (StringBuffer) CopyHelper.copy(o);
- *    s.append("... and they lived happily ever after.  The End.");
- *    r.put("stringBuf", s);
- *  </pre>
+ * A static helper for optimally creating copies. Creating copies of cache values provides
improved
+ * concurrency as well as isolation. For transactions, creating a copy is the guaranteed
way to
+ * enforce "Read Committed" isolation on changes to cache <code>Entries</code>.
+ * 
+ * <p>
+ * Here is a simple example of how to use <code>CopyHelper.copy</code>
+ * 
+ * <pre>
+ * Object o = r.get("stringBuf");
+ * StringBuffer s = (StringBuffer) CopyHelper.copy(o);
+ * s.append("... and they lived happily ever after.  The End.");
+ * r.put("stringBuf", s);
+ * </pre>
  *
  * @see Cloneable
  * @see Serializable
@@ -61,13 +60,11 @@ import org.apache.geode.pdx.internal.PdxUnreadData;
 public final class CopyHelper {
 
   // no instances allowed
-  private CopyHelper() {
-  }
+  private CopyHelper() {}
 
   /**
-   * Return true if the given object is an instance of a well known
-   * immutable class.
-   * The well known classes are:
+   * Return true if the given object is an instance of a well known immutable class. The
well known
+   * classes are:
    * <ul>
    * <li>String
    * <li>Byte
@@ -82,6 +79,7 @@ public final class CopyHelper {
    * <li>UUID
    * <li>PdxInstance but not WritablePdxInstance
    * </ul>
+   * 
    * @param o the object to check
    * @return true if o is an instance of a well known immutable class.
    * @since GemFire 6.6.2
@@ -91,48 +89,62 @@ public final class CopyHelper {
       return true;
     }
     if (o instanceof Number) {
-      if (o instanceof Integer) return true;
-      if (o instanceof Long) return true;
-      if (o instanceof Byte) return true;
-      if (o instanceof Short) return true;
-      if (o instanceof Float) return true;
-      if (o instanceof Double) return true;
+      if (o instanceof Integer)
+        return true;
+      if (o instanceof Long)
+        return true;
+      if (o instanceof Byte)
+        return true;
+      if (o instanceof Short)
+        return true;
+      if (o instanceof Float)
+        return true;
+      if (o instanceof Double)
+        return true;
       // subclasses of non-final classes may be mutable
-      if (o.getClass().equals(BigInteger.class)) return true;
-      if (o.getClass().equals(BigDecimal.class)) return true;
+      if (o.getClass().equals(BigInteger.class))
+        return true;
+      if (o.getClass().equals(BigDecimal.class))
+        return true;
     }
     if (o instanceof PdxInstance && !(o instanceof WritablePdxInstance)) {
       // no need to copy since it is immutable
       return true;
     }
-    if (o instanceof Character) return true;
-    if (o instanceof UUID) return true;
+    if (o instanceof Character)
+      return true;
+    if (o instanceof UUID)
+      return true;
     return false;
   }
+
   /**
-   * <p>Makes a copy of the specified object. The object returned is not guaranteed
-   * to be a deep copy of the original object, as explained below.
+   * <p>
+   * Makes a copy of the specified object. The object returned is not guaranteed to be a
deep copy
+   * of the original object, as explained below.
    * 
-   * <p>Copies can only be made if the original is a <tt>Cloneable</tt>
or serializable by 
-   * GemFire.
-   * If o is a {@link #isWellKnownImmutableInstance(Object) well known immutable instance}
-   * then it will be returned without copying it.
+   * <p>
+   * Copies can only be made if the original is a <tt>Cloneable</tt> or serializable
by GemFire. If
+   * o is a {@link #isWellKnownImmutableInstance(Object) well known immutable instance} then
it will
+   * be returned without copying it.
    * 
-   * <p>If the argument o is an instance of {@link java.lang.Cloneable}, a copy is
-   * made by invoking <tt>clone</tt> on it. Note that not all implementations
of <tt>clone</tt> 
-   * make deep copies (e.g. {@link java.util.HashMap#clone HashMap.clone}). Otherwise, if
the
-   * argument is not an instance of <tt>Cloneable</tt>, a copy is made using
serialization: if 
-   * GemFire serialization is implemented, it is used; otherwise, java serialization is used.
+   * <p>
+   * If the argument o is an instance of {@link java.lang.Cloneable}, a copy is made by invoking
+   * <tt>clone</tt> on it. Note that not all implementations of <tt>clone</tt>
make deep copies
+   * (e.g. {@link java.util.HashMap#clone HashMap.clone}). Otherwise, if the argument is
not an
+   * instance of <tt>Cloneable</tt>, a copy is made using serialization: if GemFire
serialization is
+   * implemented, it is used; otherwise, java serialization is used.
    * 
-   * <p> The difference between this method and {@link #deepCopy(Object) deepCopy},
is that
-   * this method uses <tt>clone</tt> if available, whereas <tt>deepCopy</tt>
does not. As a
-   * result, for <tt>Cloneable</tt> objects copied using this method, how deep
a copy the 
-   * returned object is depends on its implementation of <tt>clone</tt>. 
+   * <p>
+   * The difference between this method and {@link #deepCopy(Object) deepCopy}, is that this
method
+   * uses <tt>clone</tt> if available, whereas <tt>deepCopy</tt>
does not. As a result, for
+   * <tt>Cloneable</tt> objects copied using this method, how deep a copy the
returned object is
+   * depends on its implementation of <tt>clone</tt>.
    * 
    * @param o the original object that a copy is needed of
    * @return the new instance that is a copy of of the original
-   * @throws CopyException if copying fails because a class could not
-   * be found or could not be serialized.
+   * @throws CopyException if copying fails because a class could not be found or could not
be
+   *         serialized.
    * @see #deepCopy(Object)
    * @since GemFire 4.0
    */
@@ -145,7 +157,8 @@ public final class CopyHelper {
       } else if (o instanceof Token) {
         return o;
       } else {
-        if (isWellKnownImmutableInstance(o)) return o;
+        if (isWellKnownImmutableInstance(o))
+          return o;
         if (o instanceof Cloneable) {
           try {
             // Note that Object.clone is protected so we need to use reflection
@@ -158,7 +171,7 @@ public final class CopyHelper {
             // because Object.clone is protected.
             Method m = c.getDeclaredMethod("clone", new Class[0]);
             m.setAccessible(true);
-            copy = (T)m.invoke(o, new Object[0]);
+            copy = (T) m.invoke(o, new Object[0]);
             return copy;
           } catch (NoSuchMethodException ignore) {
             // try using Serialization
@@ -171,7 +184,8 @@ public final class CopyHelper {
             if (cause instanceof CloneNotSupportedException) {
               // try using Serialization
             } else {
-              throw new CopyException(LocalizedStrings.CopyHelper_CLONE_FAILED.toLocalizedString(),
cause != null ? cause : ex);
+              throw new CopyException(LocalizedStrings.CopyHelper_CLONE_FAILED.toLocalizedString(),
+                  cause != null ? cause : ex);
             }
           }
         } else if (o instanceof CachedDeserializable) {
@@ -179,28 +193,28 @@ public final class CopyHelper {
           return copy;
         } else if (o.getClass().isArray() && o.getClass().getComponentType().isPrimitive())
{
           if (o instanceof byte[]) {
-            byte[] a = (byte[])o;
+            byte[] a = (byte[]) o;
             copy = (T) Arrays.copyOf(a, a.length);
           } else if (o instanceof boolean[]) {
-            boolean[] a = (boolean[])o;
+            boolean[] a = (boolean[]) o;
             copy = (T) Arrays.copyOf(a, a.length);
           } else if (o instanceof char[]) {
-            char[] a = (char[])o;
+            char[] a = (char[]) o;
             copy = (T) Arrays.copyOf(a, a.length);
           } else if (o instanceof int[]) {
-            int[] a = (int[])o;
+            int[] a = (int[]) o;
             copy = (T) Arrays.copyOf(a, a.length);
           } else if (o instanceof long[]) {
-            long[] a = (long[])o;
+            long[] a = (long[]) o;
             copy = (T) Arrays.copyOf(a, a.length);
           } else if (o instanceof short[]) {
-            short[] a = (short[])o;
+            short[] a = (short[]) o;
             copy = (T) Arrays.copyOf(a, a.length);
           } else if (o instanceof float[]) {
-            float[] a = (float[])o;
+            float[] a = (float[]) o;
             copy = (T) Arrays.copyOf(a, a.length);
           } else if (o instanceof double[]) {
-            double[] a = (double[])o;
+            double[] a = (double[]) o;
             copy = (T) Arrays.copyOf(a, a.length);
           }
           return copy;
@@ -217,20 +231,22 @@ public final class CopyHelper {
   }
 
   /**
-   * Makes a deep copy of the specified object o using serialization, so the object
-   * has to be serializable by GemFire. 
+   * Makes a deep copy of the specified object o using serialization, so the object has to
be
+   * serializable by GemFire.
    * 
-   * <p>If o is a {@link #isWellKnownImmutableInstance(Object) well known immutable

-   * instance} then it will be returned without copying it.
+   * <p>
+   * If o is a {@link #isWellKnownImmutableInstance(Object) well known immutable instance}
then it
+   * will be returned without copying it.
    * 
-   * <p>The passed in object is serialized in memory, and then deserialized into 
-   * a new instance, which is returned. If GemFire serialization is implemented 
-   * for the object, it is used; otherwise, java serialization is used.  
+   * <p>
+   * The passed in object is serialized in memory, and then deserialized into a new instance,
which
+   * is returned. If GemFire serialization is implemented for the object, it is used; otherwise,
+   * java serialization is used.
    * 
    * @param o the original object to be copied
    * @return the new instance that is a copy of the original
-   * @throws CopyException if copying fails because a class could not
-   * be found or could not be serialized
+   * @throws CopyException if copying fails because a class could not be found or could not
be
+   *         serialized
    * @see #copy(Object)
    */
   public static <T> T deepCopy(T o) {
@@ -252,15 +268,19 @@ public final class CopyHelper {
   }
 
   @SuppressWarnings("unchecked")
-  private static<T> T doDeepCopy(T o) {
+  private static <T> T doDeepCopy(T o) {
     try {
       HeapDataOutputStream hdos = new HeapDataOutputStream(Version.CURRENT);
       DataSerializer.writeObject(o, hdos);
-      return (T)DataSerializer.readObject(new DataInputStream(hdos.getInputStream()));
+      return (T) DataSerializer.readObject(new DataInputStream(hdos.getInputStream()));
     } catch (ClassNotFoundException ex) {
-      throw new CopyException(LocalizedStrings.CopyHelper_COPY_FAILED_ON_INSTANCE_OF_0.toLocalizedString(o.getClass()),
ex);
+      throw new CopyException(
+          LocalizedStrings.CopyHelper_COPY_FAILED_ON_INSTANCE_OF_0.toLocalizedString(o.getClass()),
+          ex);
     } catch (IOException ex) {
-      throw new CopyException(LocalizedStrings.CopyHelper_COPY_FAILED_ON_INSTANCE_OF_0.toLocalizedString(o.getClass()),
ex);
+      throw new CopyException(
+          LocalizedStrings.CopyHelper_COPY_FAILED_ON_INSTANCE_OF_0.toLocalizedString(o.getClass()),
+          ex);
     }
 
   }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8bf39571/geode-core/src/main/java/org/apache/geode/DataSerializable.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/DataSerializable.java b/geode-core/src/main/java/org/apache/geode/DataSerializable.java
index d7c60a5..4c35c31 100644
--- a/geode-core/src/main/java/org/apache/geode/DataSerializable.java
+++ b/geode-core/src/main/java/org/apache/geode/DataSerializable.java
@@ -1,137 +1,114 @@
 /*
- * 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
+ * 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
+ * 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.
+ * 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 org.apache.geode;
 
 import java.io.*;
 
 /**
- * An interface for objects whose state can be written/read as
- * primitive types and strings ("data").  That is, instead of
- * serializing itself to an {@link java.io.ObjectOutputStream}, a
- * <code>DataSerializable</code> can serialize itself to a {@link
- * DataOutput}.  By implementing this interface, objects can be
- * serialized faster and in a more compact format than standard Java
- * serialization.  The {@link DataSerializer} class contains a number
- * of static methods that may be helpful to implementations of
- * <code>DataSerializable</code>.
+ * An interface for objects whose state can be written/read as primitive types and strings
("data").
+ * That is, instead of serializing itself to an {@link java.io.ObjectOutputStream}, a
+ * <code>DataSerializable</code> can serialize itself to a {@link DataOutput}.
By implementing this
+ * interface, objects can be serialized faster and in a more compact format than standard
Java
+ * serialization. The {@link DataSerializer} class contains a number of static methods that
may be
+ * helpful to implementations of <code>DataSerializable</code>.
  *
  * <P>
  *
- * When possible, GemFire respects the <code>DataSerializable</code>
- * contract to provide optimal object serialization.  For instance, if
- * a <code>DataSerializable</code> object is 
- * {@linkplain org.apache.geode.cache.Region#put(Object, Object) placed} into a distributed
- * cache region, its <code>toData</code> method will be used to
- * serialize it when it is sent to another member of the distributed
- * system.
+ * When possible, GemFire respects the <code>DataSerializable</code> contract
to provide optimal
+ * object serialization. For instance, if a <code>DataSerializable</code> object
is
+ * {@linkplain org.apache.geode.cache.Region#put(Object, Object) placed} into a distributed
cache
+ * region, its <code>toData</code> method will be used to serialize it when it
is sent to another
+ * member of the distributed system.
  *
  * <P>
  *
- * To avoid the overhead of Java reflection,
- * <code>DataSerializable</code> classes may register an {@link
- * Instantiator} to be used during deserialization.  Alternatively,
- * classes that implement <code>DataSerializable</code> can provide a
- * zero-argument constructor that will be invoked when they are read
- * with {@link DataSerializer#readObject}.
+ * To avoid the overhead of Java reflection, <code>DataSerializable</code> classes
may register an
+ * {@link Instantiator} to be used during deserialization. Alternatively, classes that implement
+ * <code>DataSerializable</code> can provide a zero-argument constructor that
will be invoked when
+ * they are read with {@link DataSerializer#readObject}.
  *
  * <P>
  *
- * Some classes (especially third-party classes that you may not have
- * the source code to) cannot be modified to implement
- * <code>DataSerializable</code>.  These classes can be data
- * serialized by an instance of {@link DataSerializer}.
+ * Some classes (especially third-party classes that you may not have the source code to)
cannot be
+ * modified to implement <code>DataSerializable</code>. These classes can be
data serialized by an
+ * instance of {@link DataSerializer}.
  *
  * <P>
  *
- * <code>DataSerializable</code> offers improved performance over
- * standard Java serialization, but does not offer all of the features
- * of standard Java serialization.  In particular, data serialization
- * does not attempt to maintain referential integrity among the
- * objects it is writing or reading.  As a result, data serialization
- * should not be used with complex object graphs.  Attempting to data
- * serialize graphs that contain object cycles will result in infinite
- * recursion and a {@link StackOverflowError}.  Attempting to
- * deserialize an object graph that contains multiple reference
- * paths to the same object will result in multiple copies of the
- * objects that are referred to through multiple paths.
+ * <code>DataSerializable</code> offers improved performance over standard Java
serialization, but
+ * does not offer all of the features of standard Java serialization. In particular, data
+ * serialization does not attempt to maintain referential integrity among the objects it
is writing
+ * or reading. As a result, data serialization should not be used with complex object graphs.
+ * Attempting to data serialize graphs that contain object cycles will result in infinite
recursion
+ * and a {@link StackOverflowError}. Attempting to deserialize an object graph that contains
+ * multiple reference paths to the same object will result in multiple copies of the objects
that
+ * are referred to through multiple paths.
  *
  * <P>
  *
  * <CENTER>
- * <IMG src="{@docRoot}/javadoc-images/data-serialization-exceptions.gif"
- *      HEIGHT="219" WIDTH="698">
+ * <IMG src="{@docRoot}/javadoc-images/data-serialization-exceptions.gif" HEIGHT="219"
WIDTH="698">
  * </CENTER>
  *
  * @see java.io.Serializable
  * @see DataSerializer
  * @see Instantiator
  *
- * @since GemFire 3.5 */
+ * @since GemFire 3.5
+ */
 public interface DataSerializable extends Serializable {
 
   /**
-   * Writes the state of this object as primitive data to the given
-   * <code>DataOutput</code>.
+   * Writes the state of this object as primitive data to the given <code>DataOutput</code>.
    * <p>
-   * Since 5.7 it is possible for any method call to the specified
-   * <code>DataOutput</code> to throw {@link GemFireRethrowable}.
-   * It should <em>not</em> be caught by user code.
-   * If it is it <em>must</em> be rethrown.
+   * Since 5.7 it is possible for any method call to the specified <code>DataOutput</code>
to throw
+   * {@link GemFireRethrowable}. It should <em>not</em> be caught by user code.
If it is it
+   * <em>must</em> be rethrown.
    *
-   * @throws IOException
-   *         A problem occurs while writing to <code>out</code>
+   * @throws IOException A problem occurs while writing to <code>out</code>
    */
   public void toData(DataOutput out) throws IOException;
 
   /**
-   * Reads the state of this object as primitive data from the given
-   * <code>DataInput</code>. 
+   * Reads the state of this object as primitive data from the given <code>DataInput</code>.
    *
-   * @throws IOException
-   *         A problem occurs while reading from <code>in</code>
-   * @throws ClassNotFoundException
-   *         A class could not be loaded while reading from
-   *         <code>in</code> 
+   * @throws IOException A problem occurs while reading from <code>in</code>
+   * @throws ClassNotFoundException A class could not be loaded while reading from <code>in</code>
    */
-  public void fromData(DataInput in)
-    throws IOException, ClassNotFoundException;
+  public void fromData(DataInput in) throws IOException, ClassNotFoundException;
 
-  ////////////////////////  Inner Classes  ////////////////////////
+  //////////////////////// Inner Classes ////////////////////////
 
   /**
-   * <code>Replaceable</code> allows an object to write an alternative
-   * version of itself to a <code>DataOutput</code>.  It is similar to
-   * the <code>writeReplace</code> method of standard Java
-   * {@linkplain java.io.Serializable serialization}.  
+   * <code>Replaceable</code> allows an object to write an alternative version
of itself to a
+   * <code>DataOutput</code>. It is similar to the <code>writeReplace</code>
method of standard Java
+   * {@linkplain java.io.Serializable serialization}.
    *
    * <P>
    *
-   * Note that if a <code>Replaceable</code> is also
-   * <code>DataSerializable</code>, its <code>toData</code> method
-   * will <B>not</B> be invoked.  Instead, its replacement object will
-   * be written to the stream using {@link DataSerializer#writeObject(Object, DataOutput)}.

+   * Note that if a <code>Replaceable</code> is also <code>DataSerializable</code>,
its
+   * <code>toData</code> method will <B>not</B> be invoked. Instead,
its replacement object will be
+   * written to the stream using {@link DataSerializer#writeObject(Object, DataOutput)}.
    *
    * @see DataSerializer#writeObject(Object, DataOutput)
    */
   public interface Replaceable {
 
     /**
-     * Replaces this object with another in the "output stream"
-     * written by {@link DataSerializer#writeObject(Object, DataOutput)}.
+     * Replaces this object with another in the "output stream" written by
+     * {@link DataSerializer#writeObject(Object, DataOutput)}.
      */
     public Object replace() throws IOException;
   }



Mime
View raw message