public class MarshalledValue extends Object implements Serializable
MarshalledValueInterceptor
handles transparent wrapping/unwrapping of cached
data.
NOTE: the compact(boolean, boolean)
ed and a preference is set accordingly.
Note also that this will affect the way keys stored in the cache will work, if storeAsBinary is used, since
comparisons happen on the key which will be wrapped by a MarshalledValue
. Implementers of equals()
methods of their keys need to be aware of this.
This class can be marshalled either via its externalizer or via the JVM
serialization. The reason for supporting both methods is to enable
third-party libraries to be able to marshall/unmarshall them using standard
JVM serialization rules. The Infinispan marshalling layer will always
chose the most performant one, aka the externalizer method.MarshalledValueInterceptor
,
Serialized FormModifier and Type | Class and Description |
---|---|
static class |
MarshalledValue.Externalizer |
Modifier and Type | Field and Description |
---|---|
protected Object |
instance |
protected byte[] |
raw |
protected int |
serialisedSize |
Constructor and Description |
---|
MarshalledValue(Object instance,
boolean equalityPreferenceForInstance,
StreamingMarshaller marshaller) |
Modifier and Type | Method and Description |
---|---|
void |
compact(boolean preferSerializedRepresentation,
boolean force)
Compacts the references held by this class to a single reference.
|
Object |
deserialize() |
boolean |
equals(Object o) |
Object |
get()
Returns the 'cached' instance
|
byte[] |
getRaw() |
int |
hashCode() |
static boolean |
isTypeExcluded(Class<?> type)
Tests whether the type should be excluded from MarshalledValue wrapping.
|
byte[] |
serialize() |
MarshalledValue |
setEqualityPreferenceForInstance(boolean equalityPreferenceForInstance) |
String |
toString() |
protected volatile Object instance
protected volatile byte[] raw
protected volatile int serialisedSize
public MarshalledValue(Object instance, boolean equalityPreferenceForInstance, StreamingMarshaller marshaller)
public byte[] serialize()
public Object deserialize()
public void compact(boolean preferSerializedRepresentation, boolean force)
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.public byte[] getRaw()
public Object get()
public MarshalledValue setEqualityPreferenceForInstance(boolean equalityPreferenceForInstance)
public static boolean isTypeExcluded(Class<?> type)
type
- type to test. Should not be null.Copyright © 2012 JBoss by Red Hat. All Rights Reserved.