|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object
|
+--goodsjpi.Metaobject
|
+--goodsjpi.BasicMetaobject
BasicMetaobject implements all the transaction logic.
Specifically pre/postDaemon are implemented to call begin/end read/write Access
and call commit + abort Transaction.
Locking is not implemented here, but in the subclasses. The functions begin/end
read/write Access serve as hooks to do so.
| Field Summary |
| Fields inherited from class goodsjpi.Metaobject |
CONSTRUCTOR, EXCEPTION, MUTATOR, VARIABLE |
| Constructor Summary | |
BasicMetaobject()
|
|
| Method Summary | |
protected static void |
abortTransaction()
abortTransaction aborts for the static
CacheManager.getCacheManger (per thread) and the database that the objects
in that are in. calls |
protected static void |
abortTransaction(goodsjpi.CacheManager mng,
goodsjpi.Database db)
abortTransaction obviously aborts the Transaction in progress.
|
static void |
beginNestedTransaction()
By incrementing nested transaction count we delay implicit transaction commit until the moment when counter is explicitly decremented by endNestedTransactionMethod() |
protected void |
commitObjectChanges(goodsjpi.Persistent obj)
commitObjectChanges is called during commitTransaction. |
protected static void |
commitTransaction()
At this moment there are no more active methods for classes controlled by this metaobject (or metaobjects derived from it). |
protected void |
destroyObject(goodsjpi.Persistent obj)
Destoroy all object references to make it possible to provide more unaccessible objects to GC The objects state is set to DESTRUCTED | RAW |
static void |
endNestedTransaction()
endNestedTransaction decreases the cache managers
nestedTransaction counter, and if that hits 0 calls commitTransaction |
protected void |
forgetObject(goodsjpi.Persistent obj)
forgetObject is called when the objects finalize() is called, if
it's opid is still valid. |
protected void |
invalidateObject(goodsjpi.Persistent obj)
This method is asynchronously called by server storag agent when deterioration notification from server is received. |
protected void |
loadObject(goodsjpi.Persistent obj)
loadObject is not so much the loading of the Object, ,but a
notification thereof. |
protected void |
makePersistent(goodsjpi.Persistent obj,
goodsjpi.Persistent parent)
Assign persistent identifier to the transient object of persistent capable class. |
protected void |
notifyOnModification(goodsjpi.Persistent obj,
boolean enabled)
Enable or disable notification on receving invalidation messages from the server for this object. |
void |
postDaemon(java.lang.Object o,
int attr,
boolean modified)
Invocation of postDaemon is inserted by MOP geneator after each
method invocation or object component access. |
void |
preDaemon(java.lang.Object o,
int attr)
Invocation of preDaemon is inserted by MOP geneator before each
method invocation or object component access. |
protected void |
preloadObject(goodsjpi.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 The function adjusts the cache Managers cacheSize appropriately |
protected void |
releaseObject(goodsjpi.Persistent obj)
releaseObject is called during a commitTransaction, for objects
that have not been modified. |
protected static void |
sendForgottenObjectsToServers(goodsjpi.CacheManager mng)
Object thrown by GC from weak cache are linked into forgottenObjectList list and notifications are send to servers at the transaction commit time. |
protected void |
undoObjectChanges(goodsjpi.Persistent obj)
undoObjectChanges is called during an abortTransaction. |
| Methods inherited from class goodsjpi.Metaobject |
beginReadAccess, beginWriteAccess, endAccess, modify, mutator |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public BasicMetaobject()
| Method Detail |
public void preDaemon(java.lang.Object o,
int attr)
preDaemon is inserted by MOP geneator before each
method invocation or object component access. See MetaObject
preDaemon in class Metaobjecto - an Object value that is modifiedattr - an int flag, saying what kind of modufucation
public void postDaemon(java.lang.Object o,
int attr,
boolean modified)
postDaemon is inserted by MOP geneator after each
method invocation or object component access. See also MetaObject
postDaemon in class Metaobjecto - an Object, or really a Persistent, that has been changedattr - an int, indicating where/how the chage 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.
protected void makePersistent(goodsjpi.Persistent obj,
goodsjpi.Persistent parent)
makePersistent in class Metaobjectobj - a Persistent value that is made persistentparent - a Persistent into whose storage obj is placed, if
obj is newprotected static void sendForgottenObjectsToServers(goodsjpi.CacheManager mng)
mng - a CacheManager valueprotected static void commitTransaction()
protected static void abortTransaction(goodsjpi.CacheManager mng,
goodsjpi.Database db)
abortTransaction obviously aborts the Transaction in progress.
This is done by calling undoObjectChanges on each Objects metaobject, and
calling abortTransaction on the DB.
mng - a CacheManager that provides the list of objects
that participate in the Transaction. (mng.transObjects)db - a Database, in which all participating Objects must beprotected static void abortTransaction()
abortTransaction aborts for the static
CacheManager.getCacheManger (per thread) and the database that the objects
in that are in. calls
protected void commitObjectChanges(goodsjpi.Persistent obj)
commitObjectChanges is called during commitTransaction. The
object is removed from the transaction list of the cache manager. If the obj
is invalidated, it's destroyed (this.destroyObject()).
commitObjectChanges in class Metaobjectobj - a Persistent object to commitprotected void undoObjectChanges(goodsjpi.Persistent obj)
undoObjectChanges is called during an abortTransaction.
undoObjectChanges in class Metaobjectobj - a Persistent value
protected void preloadObject(goodsjpi.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
preloadObject in class Metaobjectobj - a Persistent that has been read (from the net)size - an int, how many bytes the data member will holdprotected void loadObject(goodsjpi.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.
loadObject in class Metaobjectobj - a Persistent object that has been loadedprotected void forgetObject(goodsjpi.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 desroyed 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.
forgetObject in class Metaobjectobj - a Persistent that has become localy unreachableprotected void releaseObject(goodsjpi.Persistent obj)
releaseObject is called during a commitTransaction, for objects
that have not been modified. The Object is removed from the Transaction list
and unlocked (if it was). If NOTIFY is set on the object we keep it in cache.
releaseObject in class Metaobjectobj - a Persistent to be released.protected void destroyObject(goodsjpi.Persistent obj)
destroyObject in class Metaobjectobj - a Persistent valueprotected void invalidateObject(goodsjpi.Persistent obj)
invalidateObject in class Metaobjectobj - a Persistent object to be invalidated.
protected void notifyOnModification(goodsjpi.Persistent obj,
boolean enabled)
notifyOnModification in class Metaobjectobj - a Persistent to make the notification changes forenabled - a boolean, whether notifications are used for this
objectpublic static void beginNestedTransaction()
public static void endNestedTransaction()
endNestedTransaction decreases the cache managers
nestedTransaction counter, and if that hits 0 calls commitTransaction
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||