org.prevayler.foundation
Class DeepCopier

java.lang.Object
  extended by org.prevayler.foundation.DeepCopier

public class DeepCopier
extends Object


Constructor Summary
DeepCopier()
           
 
Method Summary
static Object deepCopy(Object original)
          Same as deepCopy(original, new JavaSerializer()).
static Object deepCopy(Object original, Serializer serializer)
          Produce a deep copy of the given object.
static Object deepCopyParallel(Object original, Serializer serializer)
          Produce a deep copy of the given object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DeepCopier

public DeepCopier()
Method Detail

deepCopy

public static Object deepCopy(Object original)
Same as deepCopy(original, new JavaSerializer()).

Throws:
ClassNotFoundException
IOException

deepCopy

public static Object deepCopy(Object original,
                              Serializer serializer)
Produce a deep copy of the given object. Serializes the entire object to a byte array in memory. Recommended for relatively small objects, such as individual transactions.


deepCopyParallel

public static Object deepCopyParallel(Object original,
                                      Serializer serializer)
                               throws Exception
Produce a deep copy of the given object. Serializes the object through a pipe between two threads. Recommended for very large objects, such as an entire prevalent system. The current thread is used for serializing the original object in order to respect any synchronization the caller may have around it, and a new thread is used for deserializing the copy.

Throws:
Exception


Copyright © 2001-2013. All Rights Reserved.