GemFire 7.0.1

com.gemstone.gemfire
Class CopyHelper

java.lang.Object
  extended by com.gemstone.gemfire.CopyHelper

public final class CopyHelper
extends Object

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 Entries.

Here is a simple example of how to use CopyHelper.copy

    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);
  

Since:
4.0
See Also:
Cloneable, Serializable, DataSerializer, GemFireCache.setCopyOnRead(boolean), CacheTransactionManager

Method Summary
static
<T> T
copy(T o)
          Makes a copy of the specified object.
static boolean isWellKnownImmutableInstance(Object o)
          Return true if the given object is an instance of a well known immutable class.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

isWellKnownImmutableInstance

public static boolean isWellKnownImmutableInstance(Object o)
Return true if the given object is an instance of a well known immutable class. The well known classes are:

Parameters:
o - the object to check
Returns:
true if o is an instance of a well known immutable class.
Since:
6.6.2

copy

public static <T> T copy(T o)

Makes a copy of the specified object. Copies can only be made if the original is Cloneable or serializable by GemFire. If o is a well known immutable instance then it will be returned without copying it.

Parameters:
o - the original object that a copy is needed of
Returns:
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.
Since:
4.0

GemFire 7.0.1

Copyright © 1997-2013 VMware, Inc. All rights reserved.