fabric.lang
Class Object._Impl

java.lang.Object
  extended by fabric.lang.Object._Impl
All Implemented Interfaces:
Object, java.lang.Cloneable
Direct Known Subclasses:
_booleanArray._Impl, _byteArray._Impl, _charArray._Impl, _doubleArray._Impl, _floatArray._Impl, _intArray._Impl, _longArray._Impl, _ObjectArray._Impl, _shortArray._Impl, Object._Static._Impl, Principal._Impl, Principal._Static._Impl, Surrogate
Enclosing interface:
Object

public static class Object._Impl
extends java.lang.Object
implements Object, java.lang.Cloneable

_Impl objects hold the actual code and data of Fabric objects and may be evicted from memory.


Nested Class Summary
 
Nested classes/interfaces inherited from interface fabric.lang.Object
Object._Impl, Object._Proxy, Object._Static
 
Field Summary
protected  Object._Proxy $class
          A reference to the class object.
 Object._Impl $history
          Modification log.
 boolean $isOwned
          Whether this worker owns the most up-to-date copy of the object.
protected  Label $label
           
 int $numWaiting
          The number of threads waiting on this object.
 Log $reader
          Any transaction that has logged a read of the object, or null if none.
 ReadMapEntry $readMapEntry
          A reference to the global read list for this object.
 FabricSoftRef $ref
           
 int $updateMapVersion
          The version number on the last update-map that was checked.
 int $version
           
 Log $writeLockHolder
          The innermost transaction that is holding a write lock on the object.
 Log $writer
          The unique running transaction that can write to the object, or null if none.
 
Constructor Summary
Object._Impl(Store store, Label label)
          Creates a new Fabric object that will reside on the given Store.
Object._Impl(Store store, long onum, int version, long expiry, long label, java.io.ObjectInput serializedInput, java.util.Iterator<RefTypeEnum> refTypes, java.util.Iterator<java.lang.Long> intraStoreRefs)
          This is the deserialization constructor and reconstructs the object from its serialized state.
 
Method Summary
static void _npe(Label lbl)
          A dummy method.
 void $copyAppStateFrom(Object._Impl other)
          This copies the application state of the object.
 void $copyStateFrom(Object._Impl other)
          This is used to restore the state of the object during transaction roll-back.
 void $forceRenumber(long onum)
          Deprecated.  
 Object._Proxy $getClass()
           
 long $getOnum()
          The object's onum.
 Object._Proxy $getProxy()
          A proxy for this object.
 Store $getStore()
          The store where the object resides.
 int $getVersion()
           
protected  Object._Proxy $makeProxy()
          Subclasses should override this method.
protected static Object $readRef(java.lang.Class<? extends Object._Proxy> proxyClass, RefTypeEnum refType, java.io.ObjectInput in, Store store, java.util.Iterator<java.lang.Long> intraStoreRefs)
          A helper method for reading a pointer during object deserialization.
 void $serialize(java.io.ObjectOutput serializedOutput, java.util.List<RefTypeEnum> refTypes, java.util.List<java.lang.Long> intraStoreRefs, java.util.List<Pair<java.lang.String,java.lang.Long>> interStoreRefs)
          Serializes the non-transient fields of this object.
 java.lang.Object $unwrap()
          Unwraps a wrapped Java inlineable.
protected static void $writeInline(java.io.ObjectOutput out, java.lang.Object obj)
          Serializes an object to the given ObjectOutput.
protected static void $writeRef(Store store, Object obj, java.util.List<RefTypeEnum> refType, java.io.ObjectOutput out, java.util.List<java.lang.Long> intraStoreRefs, java.util.List<Pair<java.lang.String,java.lang.Long>> interStoreRefs)
          A helper method for serializing a reference during object serialization.
 Object._Impl clone()
           
 Statistics createStatistics()
          Creates a Statistics object to determine promises for this Object.
 boolean equals(java.lang.Object o)
          Default equals implementation uses pointer equality.
 boolean equals(Object o)
          Default equals implementation uses pointer equality.
 Object._Impl fetch()
          Fetches the object if this is a proxy; returns itself if it's an impl.
 Label get$label()
          Label for this object
 int hashCode()
          Default hashCode implementation uses the OID to compute the hash value.
 boolean idEquals(Object other)
          Whether this object has the same identity as another object.
 java.lang.String toString()
          Default toString implementation prints out the class name and global object name.
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

$ref

public final FabricSoftRef $ref

$class

protected Object._Proxy $class
A reference to the class object. TODO Figure out class loading.


$label

protected Label $label

$version

public int $version

$writer

public Log $writer
The unique running transaction that can write to the object, or null if none. (This is either null or holds the same value as $writeLockHolder.


$writeLockHolder

public Log $writeLockHolder
The innermost transaction that is holding a write lock on the object.


$reader

public Log $reader
Any transaction that has logged a read of the object, or null if none.


$history

public Object._Impl $history
Modification log. Holds the state of the object at the beginning of the transaction that currently holds the write lock. A transaction has acquired a write lock on an object if any entry in this history has $writer set to that transaction's log.


$readMapEntry

public ReadMapEntry $readMapEntry
A reference to the global read list for this object.

See Also:
TransactionManager.readMap

$numWaiting

public int $numWaiting
The number of threads waiting on this object.


$isOwned

public boolean $isOwned
Whether this worker owns the most up-to-date copy of the object.


$updateMapVersion

public int $updateMapVersion
The version number on the last update-map that was checked.

Constructor Detail

Object._Impl

public Object._Impl(Store store,
                    Label label)
             throws UnreachableNodeException
Creates a new Fabric object that will reside on the given Store.

Parameters:
store - the location for the object
label - the security label for the object
Throws:
UnreachableNodeException

Object._Impl

public Object._Impl(Store store,
                    long onum,
                    int version,
                    long expiry,
                    long label,
                    java.io.ObjectInput serializedInput,
                    java.util.Iterator<RefTypeEnum> refTypes,
                    java.util.Iterator<java.lang.Long> intraStoreRefs)
             throws java.io.IOException,
                    java.lang.ClassNotFoundException
This is the deserialization constructor and reconstructs the object from its serialized state. Subclasses should call the super constructor to first read inherited fields. It should then read the value of each non-transient field declared in this subclass. The order in which fields are presented is the same as the order used by $serialize.

Parameters:
store - The store on which the object lives.
onum - The object's onum.
version - The object's version number.
label - Onum of the object's label.
serializedInput - A stream of serialized primitive values and inlined objects.
refTypes - An iterator of RefTypeEnums indicating the type of each reference being deserialized (e.g., null, inlined, intraStore).
intraStoreRefs - An iterator of intra-store references, each represented by an onum.
Throws:
java.io.IOException
java.lang.ClassNotFoundException
Method Detail

clone

public final Object._Impl clone()
Overrides:
clone in class java.lang.Object

equals

public boolean equals(java.lang.Object o)
Default equals implementation uses pointer equality.

Overrides:
equals in class java.lang.Object

equals

public boolean equals(Object o)
Default equals implementation uses pointer equality.

Specified by:
equals in interface Object

hashCode

public int hashCode()
Default hashCode implementation uses the OID to compute the hash value.

Overrides:
hashCode in class java.lang.Object

toString

public java.lang.String toString()
Default toString implementation prints out the class name and global object name.

Overrides:
toString in class java.lang.Object

$copyStateFrom

public final void $copyStateFrom(Object._Impl other)
This is used to restore the state of the object during transaction roll-back.


$copyAppStateFrom

public void $copyAppStateFrom(Object._Impl other)
This copies the application state of the object. Subclasses should override this method and call super.copyAppStateFrom(other).


$getStore

public final Store $getStore()
Description copied from interface: Object
The store where the object resides.

Specified by:
$getStore in interface Object

$getOnum

public final long $getOnum()
Description copied from interface: Object
The object's onum.

Specified by:
$getOnum in interface Object

$getClass

public final Object._Proxy $getClass()

get$label

public final Label get$label()
Description copied from interface: Object
Label for this object

Specified by:
get$label in interface Object

$getVersion

public final int $getVersion()

$getProxy

public final Object._Proxy $getProxy()
Description copied from interface: Object
A proxy for this object.

Specified by:
$getProxy in interface Object

idEquals

public final boolean idEquals(Object other)
Description copied from interface: Object
Whether this object has the same identity as another object.

Specified by:
idEquals in interface Object

fetch

public final Object._Impl fetch()
Description copied from interface: Object
Fetches the object if this is a proxy; returns itself if it's an impl.

Specified by:
fetch in interface Object

createStatistics

public Statistics createStatistics()
Description copied from interface: Object
Creates a Statistics object to determine promises for this Object.

Specified by:
createStatistics in interface Object

$serialize

public void $serialize(java.io.ObjectOutput serializedOutput,
                       java.util.List<RefTypeEnum> refTypes,
                       java.util.List<java.lang.Long> intraStoreRefs,
                       java.util.List<Pair<java.lang.String,java.lang.Long>> interStoreRefs)
                throws java.io.IOException
Serializes the non-transient fields of this object. Subclasses should call the super method first so that inherited fields are written before fields declared in this subclass. The order in which fields are written must be fixed and the same as the order used by the deserialization constructor.

Parameters:
serializedOutput - An output stream for writing serialized primitive values and inlined objects.
refTypes - A list to which RefTypeEnums will be written to indicate the type of reference being serialized (e.g., null, inlined, intraStore, interStore).
intraStoreRefs - A list to which onums denoting intra-store references will be written.
interStoreRefs - A list to which global object names (hostname/onum pairs), denoting inter-store references, will be written.
Throws:
java.io.IOException

$readRef

protected static final Object $readRef(java.lang.Class<? extends Object._Proxy> proxyClass,
                                       RefTypeEnum refType,
                                       java.io.ObjectInput in,
                                       Store store,
                                       java.util.Iterator<java.lang.Long> intraStoreRefs)
                                throws java.io.IOException,
                                       java.lang.ClassNotFoundException
A helper method for reading a pointer during object deserialization.

Parameters:
proxyClass - The expected proxy class for the reference being read.
refType - The type of reference being read.
in - The stream from which to read any inlined objects.
store - The store to use when constructing any intra-store references.
intraStoreRefs - An iterator of intra-store references, each represented by an onum.
Throws:
java.lang.ClassNotFoundException - Thrown when the class for a wrapped object is unavailable.
java.io.IOException - Thrown when an I/O error has occurred in the given ObjectInput stream.

$writeInline

protected static final void $writeInline(java.io.ObjectOutput out,
                                         java.lang.Object obj)
                                  throws java.io.IOException
Serializes an object to the given ObjectOutput.

Throws:
java.io.IOException

$writeRef

protected static final void $writeRef(Store store,
                                      Object obj,
                                      java.util.List<RefTypeEnum> refType,
                                      java.io.ObjectOutput out,
                                      java.util.List<java.lang.Long> intraStoreRefs,
                                      java.util.List<Pair<java.lang.String,java.lang.Long>> interStoreRefs)
                               throws java.io.IOException
A helper method for serializing a reference during object serialization.

Parameters:
store - The referring object's store.
obj - The reference to be serialized.
refType - A list to which a RefTypeEnum will be written to indicate the type of reference being serialized (e.g., null, inlined, intraStore, interStore).
out - An output stream for writing inlined objects.
intraStoreRefs - A list for writing intra-store references, represented by onums.
interStoreRefs - A list for writing denoting inter-store references, represented by global object names (hostname/onum pairs).
Throws:
java.io.IOException

$makeProxy

protected Object._Proxy $makeProxy()
Subclasses should override this method.


$unwrap

public final java.lang.Object $unwrap()
Description copied from interface: Object
Unwraps a wrapped Java inlineable.

Specified by:
$unwrap in interface Object

$forceRenumber

public final void $forceRenumber(long onum)
Deprecated. 

This method changes the onum of the object. Unless if you really know what you're doing, you should not call this, as it leaves the system in an inconsistent state.

This method is used to initialize object databases with objects at well-known onums (e.g., naming map and store principal).

Specified by:
$forceRenumber in interface Object

_npe

public static void _npe(Label lbl)
                 throws java.lang.NullPointerException
A dummy method. This is a hack for working around reachability problems in generated code.

Throws:
java.lang.NullPointerException