|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectgoodsjpi.Metaobject
Metaobject
is a base class for all Transaction + locking strategies.
Each @see Persistent holds a MetaObject, which is called when the object is
modified or read. This also means you can have different strategies for different
classes, or even object if you wish. The default is PessimisticRepeatableRead
This class has abstract functions to handle loading and
unloading of Object over the wire, and to handle Transactions. Specifically
their failure strategies are implemented by different implementations of the
various derived classes.
Most functions are implemented in the BasicMetaObject, but the begin/end * Access
functions are implemented in the different derived classes.
JAVAMOP, the MetaObjectProtocol postprocessor inserts all necessary code
to call MetaObject functions into the compiled byte code.
Field Summary | |
static int |
CONSTRUCTOR
CONSTRUCTOR == 4 means wrapped method is constructor |
static int |
EXCEPTION
EXCEPTION == 8, means method is terminated by exception |
static int |
MUTATOR
MUTATOR == 1 , means object can be changed |
static int |
VARIABLE
VARIABLE == 2 , means access to non-self instance variable |
Constructor Summary | |
Metaobject()
|
Method Summary | |
protected abstract void |
beginReadAccess(Persistent obj)
beginReadAccess is called when the read Access begins. |
protected abstract void |
beginWriteAccess(Persistent obj)
beginWriteAccess is called when the write Access begins. |
protected abstract void |
commitObjectChanges(Persistent obj)
commitObjectChanges is called during commitTransaction. |
protected abstract void |
destroyObject(Persistent obj)
Destoroy all object references to make it possible to provide more unaccessible objects to GC |
protected abstract void |
endAccess(Persistent obj)
endAccess is called when the (current) access/function has ended,
and the object is not accessed anymore (the accesscount hits 0 ).
|
protected abstract void |
forgetObject(Persistent obj)
forgetObject is called when the objects finalize() is called, if
it's opid is still valid. |
protected abstract void |
invalidateObject(Persistent obj)
This method is asynchronously called by server storag agent when deterioration notification from server is received. |
protected abstract void |
loadObject(Persistent obj)
loadObject is not so much the loading of the Object, ,but a
notification thereof. |
protected abstract void |
makePersistent(Persistent obj,
Persistent parent)
makePersistent should do just that, make the obj persistent. |
static void |
modify()
modify provides MOP preprocessor with information that objects
was (or will be) modified. |
static void |
mutator()
mutator is only hint to MOP preprocessor to consider method
invoking Metaobject.mutator() as been mutator. |
protected abstract void |
notifyOnModification(Persistent obj,
boolean status)
Enable or disable notification on receving invalidation messages from the server for this object. |
abstract void |
postDaemon(java.lang.Object obj,
int attr,
boolean modified)
Invocation of this postDaemon is inserted by MOP generator after
each method invocation or object component access. |
abstract void |
preDaemon(java.lang.Object obj,
int attr)
Invocation of this preDaemon is inserted by MOP generator
before each method invocation or object component access. |
protected abstract void |
preloadObject(Persistent obj,
int size)
preloadObject is called by Storage.read() when it's bytes
have been received and just before they are copied into it's data member |
protected abstract void |
releaseObject(Persistent obj)
releaseObject is called during a commitTransaction, for objects
that have not been modified. |
protected abstract void |
undoObjectChanges(Persistent obj)
undoObjectChanges is called during an abortTransaction. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final int MUTATOR
MUTATOR
== 1 , means object can be changed
public static final int VARIABLE
VARIABLE
== 2 , means access to non-self instance variable
public static final int CONSTRUCTOR
CONSTRUCTOR
== 4 means wrapped method is constructor
public static final int EXCEPTION
EXCEPTION
== 8, means method is terminated by exception
Constructor Detail |
public Metaobject()
Method Detail |
public abstract void preDaemon(java.lang.Object obj, int attr)
preDaemon
is inserted by MOP generator
before each method invocation or object component access. (Other database
implementation call this method fetch(), to indicate that this causes
the data of the Object to be fetched, if it's not already there)
obj
- The Object
that is to be loaded. Really it is an instance
of Persistentattr
- an int
value, indicating the kind of access. An OR
combination of the static flags below.public abstract void postDaemon(java.lang.Object obj, int attr, boolean modified)
postDaemon
is inserted by MOP generator after
each method invocation or object component access.
obj
- an Object
, or really a Persistent, that has been changedattr
- an int
, indicating where/how the change happened. An OR
combination of the static flags belowmodified
- a boolean
value, indicating whether there has
actually been a change. Because of exceptions it isn't always true.public static void mutator()
mutator
is only hint to MOP preprocessor to consider method
invoking Metaobject.mutator() as been mutator. No actual code
will appear in preprocessed class file.
public static void modify()
modify
provides MOP preprocessor with information that objects
was (or will be) modified. No method invocation will appear in
preprocessed code.
protected abstract void preloadObject(Persistent obj, int size)
preloadObject
is called by Storage.read() when it's bytes
have been received and just before they are copied into it's data member
obj
- a Persistent
that has been read (from the net)size
- an int
, how many bytes the data member will holdprotected abstract void loadObject(Persistent obj)
loadObject
is not so much the loading of the Object, ,but a
notification thereof. The object is really loaded by the Storage class
(in prepare(obj) method) and after the deed is done, this method is called.
obj
- a Persistent
object that has been loadedprotected abstract void forgetObject(Persistent obj)
forgetObject
is called when the objects finalize() is called, if
it's opid is still valid. If all data were local, this would mean the object
could be destroyed because it's not reachable anymore. But because more
references may exist at the servers end, this basically reduces the reference
count at the servers side.
obj
- a Persistent
that has become locally unreachableprotected abstract void releaseObject(Persistent obj)
releaseObject
is called during a commitTransaction, for objects
that have not been modified.
obj
- a Persistent
to be released.protected abstract void commitObjectChanges(Persistent obj)
commitObjectChanges
is called during commitTransaction.
obj
- a Persistent
object to commitprotected abstract void undoObjectChanges(Persistent obj)
undoObjectChanges
is called during an abortTransaction.
obj
- a Persistent
valueprotected abstract void makePersistent(Persistent obj, Persistent parent)
makePersistent
should do just that, make the obj persistent.
obj
- a Persistent
object to make persistent (or prepare for
that)parent
- a Persistent
object "close" to the obj. May be
used , as by BasicMetaObject, to place the obj in the same storage as parent.protected abstract void beginReadAccess(Persistent obj)
beginReadAccess
is called when the read Access begins. It is called
from the (auto generated) preDeamon (in BasicMataObject) if the Mutator flag is
set.
obj
- a Persistent
object that is about to be read.protected abstract void beginWriteAccess(Persistent obj)
beginWriteAccess
is called when the write Access begins. It is
called from the (autogenerated) preDeamon (in BasicMataObject) if the Mutator
flag is not set.
obj
- a Persistent
object that is about to be read.protected abstract void endAccess(Persistent obj)
endAccess
is called when the (current) access/function has ended,
and the object is not accessed anymore (the accesscount hits 0 ).
It is called from the (autogenerated) postDeamon in BasiMetaObject.
Different implementations of this function can be found in the subclasses and
by eg locking or not locking the Object provide different strategies.
obj
- a Persistent
object that is about to be read.protected abstract void invalidateObject(Persistent obj)
obj
- a Persistent
object to be invalidated.protected abstract void destroyObject(Persistent obj)
obj
- a Persistent
valueprotected abstract void notifyOnModification(Persistent obj, boolean status)
obj
- a Persistent
to make the notification changes forstatus
- a boolean
, whether notifications are used for this
object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |