|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.sun.sgs.impl.util.AdaptiveField<T>
T - the type of the referenced objectpublic final class AdaptiveField<T>
An AdaptiveField is an abstraction over the traditional Java field
that allows a field to be stored either locally (as a normal field would be)
or remotely in the data store, while still allowing common operations as
well as the ability to dynamically switch where the field's value is stored.
A ManagedObject will deserialize all of its non-transient fields,
which at times is undesirable for latency (e.g. when the field is large, or
will not be used). An AdaptiveField allow the developer finer
control over whether a field needs to be included in the serialization graph
by providing a common interface for interacting with the field regardless of
how it is stored.
A local AdaptiveField has its value stored just like any other Java
field. When a ManagedObject deserializes from the data store, the
field will be included in its serialization graph. For this reason a ManagedObject cannot be stored in an AdaptiveField. If the
developer wants to change the field so that it is stored in the data store,
the AdaptiveField.makeManaged call can be
used. This causes the field's value to no longer be deserialized when the
containing ManagedObject is deserialized.
ManagedReference,
ManagedObject,
Serialized Form| Constructor Summary | |
|---|---|
AdaptiveField(T value)
Constructs this AdaptiveField as a local reference with the
provided value. |
|
AdaptiveField(T value,
boolean isLocal)
Constructs this AdaptiveField with the provided value, and
stores it as specified. |
|
| Method Summary | |
|---|---|
T |
get()
Returns the value of the field. |
T |
getForUpdate()
Returns the value of the field and if remotely stored, marks the value for update. |
boolean |
isLocal()
Returns true if this field is stored as a local reference. |
void |
makeLocal()
Move this field from being stored as a ManagedObject in the data
store to being kept as a local reference. |
void |
makeManaged()
Move this field from being a local Java reference to being stored as a ManagedObject in the data store. |
void |
markForUpdate()
If this field is not stored locally, marks the field for update. |
void |
set(T value)
Sets the value of this field. |
void |
set(T value,
boolean isLocal)
Sets the value of this field and updates its locality based on isLocal. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public AdaptiveField(T value)
AdaptiveField as a local reference with the
provided value.
value - the value of this field
IllegalArgumentException - if the provided value is a ManagedObject
public AdaptiveField(T value,
boolean isLocal)
AdaptiveField with the provided value, and
stores it as specified.
value - the value of this fieldisLocal - whether this field should be kept with a local reference
or stored in the data store.
IllegalArgumentException - if the provided value is a ManagedObject| Method Detail |
|---|
public T get()
DataManager.markForUpdate on
the ManagedObject that contains this field since its state has
been changed. The values of fields that are not local are cached after
the initial call to the DataManager, so subsequent calls to
get will act as if they are local.
public T getForUpdate()
DataManager.markForUpdate on the ManagedObject that contains
this field since its state has been changed.
public boolean isLocal()
true if this field is stored as a local reference.
Otherwise, the field is persisted with the DataManager and is
excluded from the serialization graph of the object that contains this
AdaptiveField.
true if this field is stored as a local referencepublic void makeLocal()
ManagedObject in the data
store to being kept as a local reference. This field will now be
included in the serialization graph of the object that contains this
field.
public void makeManaged()
ManagedObject in the data store. This field will no longer be
included in the serialization graph of the object that contains this
field.
public void markForUpdate()
public void set(T value)
value - the new value of the field
public void set(T value,
boolean isLocal)
isLocal.
value - the new value of the fieldisLocal - whether this field should be kept with a local reference
or stored in the data store.
|
RedDwarf, Version 0.10.1 2010-03-14 10:56:12 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||