org.infinispan.marshall
Class MarshalledValue
java.lang.Object
org.infinispan.marshall.MarshalledValue
public class MarshalledValue
- extends Object
Wrapper that wraps cached data, providing lazy deserialization using the calling thread's context class loader.
The MarshalledValueInterceptor
handles transparent wrapping/unwrapping of cached
data.
- Since:
- 4.0
- Author:
- Manik Surtani (manik@jboss.org), Mircea.Markus@jboss.com, Galder ZamarreƱo
- See Also:
MarshalledValueInterceptor
instance
protected volatile Object instance
raw
protected volatile byte[] raw
MarshalledValue
public MarshalledValue(Object instance,
boolean equalityPreferenceForInstance,
Marshaller marshaller)
throws NotSerializableException
- Throws:
NotSerializableException
MarshalledValue
public MarshalledValue(byte[] raw,
int cachedHashCode,
Marshaller marshaller)
init
public void init(byte[] raw,
int cachedHashCode)
serialize
public void serialize()
deserialize
public void deserialize()
compact
public void compact(boolean preferSerializedRepresentation,
boolean force)
- Compacts the references held by this class to a single reference. If only one representation exists this method
is a no-op unless the 'force' parameter is used, in which case the reference held is forcefully switched to the
'preferred representation'.
Either way, a call to compact() will ensure that only one representation is held.
- Parameters:
preferSerializedRepresentation
- if true and both representations exist, the serialized representation is
favoured. If false, the deserialized representation is preferred.force
- ensures the preferred representation is maintained and the other released,
even if this means serializing or deserializing.
getRaw
public byte[] getRaw()
get
public Object get()
- Returns the 'cached' instance. Impl note: this method is synchronized so that it synchronizez with the code that
nullifies the instance.
- See Also:
nullifyInstance()
equals
public boolean equals(Object o)
- Overrides:
equals
in class Object
hashCode
public int hashCode()
- Overrides:
hashCode
in class Object
toString
public String toString()
- Overrides:
toString
in class Object
isTypeExcluded
public static boolean isTypeExcluded(Class type)
- Tests whether the type should be excluded from MarshalledValue wrapping.
- Parameters:
type
- type to test. Should not be null.
- Returns:
- true if it should be excluded from MarshalledValue wrapping.
Copyright © 2010 JBoss, a division of Red Hat. All Rights Reserved.