GemFire 5.5

com.gemstone.gemfire
Class CopyHelper

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

public final class CopyHelper
extends Object

A static helper for optimimally 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, Cache.setCopyOnRead(boolean), CacheTransactionManager

Constructor Summary
CopyHelper()
           
 
Method Summary
static Object copy(Object o)
          Makes a copy of the specified object.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CopyHelper

public CopyHelper()
Method Detail

copy

public static Object copy(Object o)

Makes a copy of the specified object. Copies can only be made if the original is Cloneable or Serializable.

Parameters:
o - the original object that a copy is needed of
Returns:
the new instance that is a copy of of the original
Throws:
IllegalArgumentException - if the specified object is not copy-able
CopyException - if copying fails because a class could not be found.
Since:
4.0

GemFire 5.5

Copyright © 2002-2008 GemStone Systems, Inc. All Rights Reserved.