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.
![]() |
Members | Description | ||
preDaemon | Invocation of preDaemon is inserted by MOP geneator before each
method invocation or object component access. See MetaObject
This "basic" implementation increases the accesscount of the object and if
the flag indicates change, calls begin read/write Access.
Also it load, or prepares the object by calling these functions on the
objects store
|
|||
postDaemon | Invocation of postDaemon is inserted by MOP geneator after each
method invocation or object component access. See also MetaObject
This "basic" implementation decreases the accesscount of the object and
if that hits 0 calls endAccess(obj). In that case, the object is removed from
the cache manager and detroyObject is called. If that was the end of
nested Trasaction, either commitTransaction, or abortTransaction,
depending on if the flag indicates Exception is called.
|
|||
makePersistent | Assign persistent identifier to the transient object of persistent
capable class. The object is placed in the same storage as
persistent object containing reference to this object unless
explicit storage attachment was specified for this object.
|
|||
sendForgottenObjectsToServers | Object thrown by GC from weak cache are linked into forgottenObjectList
list and notifications are send to servers at the transaction
commit time. This is done because clearing weak reference by GC
is not synchronized with invocation of finalize() method. So there is
no warrenty that in the moment between object is removed from weak cache
and ionvocation of finilize method, the object with the same identifier
will not be retirieved from the server. Delayed strategy of sending
forget message together with checking object for presence in the cache
before sending foget message to the server makes sending of wrong
forgot message not possible.
OId's of Object that were "forgotten" are collected and handed to
Storage.forgetObjects
|
|||
commitTransaction | At this moment there are no more active methods for
classes controlled by this metaobject (or metaobjects derived from it).
This method will try to commit all transactions in all opened databases.
Until this method is completed no other invocation or access to
objects controled by this MOP is possible (it is forced by declaring
this static method "synchronized" as well as static method fixObject(),
which is called before any access to the object).
First sendForgottenObject is called. Then, for all modifed objects (all
others are release by metaobject.releaseObject()) we find it's database
and collect all object involved in the trasaction. If any is invalidated,
the transaction is aborted.
Each objects storage store(obj) function is called, which packs the byte
into the tranaction buffer. Then the storage's commitTransaction is called,
and if the trasaction spans several storages, those storages
commitSubtransaction are called. This send the bytes to the server, and if
anything goes wrong, abortTransaction is called.
If all went well, obj.metaObject.commitchanegs is called for every object
|
|||
abortTransaction | abortTransaction obviously aborts the Transaction in progress.
This is done by calling undoObjectChanges on each Objects metaobject, and
calling abortTransaction on the DB.
|
|||
abortTransaction | abortTransaction aborts for the static
CacheManager.getCacheManger (per thread) and the database that the objects
in that are in. calls
|
|||
commitObjectChanges | 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()).
|
|||
undoObjectChanges | undoObjectChanges is called during an abortTransaction.
The object is removed from the cache managers Trasaction list and
if locked, unlocked. If the object has been modified (dirty), new objects
are destroyed and old removed from their storage (storage.forgetObject())
|
|||
preloadObject | 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
|
|||
loadObject | 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.
This only increases the cache size appropriately
|
|||
forgetObject | 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.
Server side garbage collection will eventually reclaim the object space, if
it really has become unreachable.
The function adjusts the cache manager's cache size and links the object into the
forgottenObjectList of the cache manager
|
|||
releaseObject | 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.
DIRTY,NEW,TANS*,*LOCK flags are cleared.
|
|||
destroyObject | Destoroy all object references to make it possible to provide
more unaccessible objects to GC
The objects state is set to DESTRUCTED | RAW
|
|||
invalidateObject | This method is asynchronously called by server storag agent when
deterioration notification from server is received.
If the object does not participate in a current Transaction, it is removed
from the cache and detroyed. Otherwise the invalidated flag is set and
detruction happends after commit.
If NOTIFY is set on the object, the associated CondEvent's signal is called
|
|||
notifyOnModification | Enable or disable notification on receving invalidation messages from
the server for this object. If enable, set NOTIFY flag on the object and
remove from cache (?). Else unset the flag and insert into cache, if not
accessed.
|
|||
beginNestedTransaction | By incrementing nested transaction count we delay implicit transaction
commit until the moment when counter is explicitly decremented by
endNestedTransactionMethod()
|
|||
endNestedTransaction | endNestedTransaction decreases the cache managers
nestedTransaction counter, and if that hits 0 calls commitTransaction
|