ozone core API

org.ozoneDB.core.storage.wizardStore
Class WizardObjectContainer

java.lang.Object
  extended byorg.ozoneDB.core.AbstractObjectContainer
      extended byorg.ozoneDB.core.storage.StorageObjectContainer
          extended byorg.ozoneDB.core.storage.wizardStore.WizardObjectContainer
All Implemented Interfaces:
java.io.Externalizable, Lockable, ObjectContainer, java.io.Serializable
Direct Known Subclasses:
WizardObjectContainer

public class WizardObjectContainer
extends StorageObjectContainer

The "Wizard" implementation of the ObjectContainer interface. Much of the lock functionality is implemented in the WizardCluster class. Note: only the join/commit/abort methods are synchronized. All other methods are guaranteed to run exclusively through the explicite locks

Version:
$Revision$Date$
Author:
SMB, Medium.net
See Also:
Serialized Form

Field Summary
protected  int garbageCollectionLevel
          The garbage collection level of this ObjectContainer.
protected  int invokeCount
           
protected  long modTime
           
protected  java.lang.String name
           
protected  ObjectID objID
           
protected static long serialVersionUID
           
protected static byte subSerialVersionUID
           
protected  org.ozoneDB.OzoneCompatible target
          The currently commited target object of the container.
 
Fields inherited from class org.ozoneDB.core.storage.StorageObjectContainer
cluster
 
Fields inherited from class org.ozoneDB.core.AbstractObjectContainer
shouldCallOnActivate, shouldCallOnPassivate, state
 
Fields inherited from interface org.ozoneDB.core.ObjectContainer
IMPLNAME_POSTFIX, PROXYNAME_POSTFIX, STATE_CLEAN, STATE_CREATED, STATE_DELETED, STATE_MODIFIED, STATE_READ
 
Constructor Summary
WizardObjectContainer()
          Constructor for object serialization via Externalizable.
WizardObjectContainer(ObjectID _objID)
           
 
Method Summary
 DxCollection allLockers()
          Returns a collection of Locker objects that currently lock this Lockable object.
 void deleteTarget()
           
 int ensureGarbageCollectionLevel(int newGarbageCollectionLevel)
          Ensures that the garbageCollectionLevel is at least the given currentGarbageCollectionLevel.
 Cluster getCluster()
           
 int getGarbageCollectionLevel()
          Returns the garbageCollectionLevel this ObjectContainer has reached due to (not) calling ensureGarbageCollectionLevel(int).
 boolean hasSameClusterAs(WizardObjectContainer container)
           
 ObjectID id()
           
 void invokeOnActivate()
           
 java.lang.Object invokeTarget(Env env, java.lang.String methodName, java.lang.String sig, java.lang.Object[] args)
           
protected  boolean isCreated()
           
 boolean isDeleted()
           
 boolean isInvoked()
           
 boolean isPinned()
          Returns wether this ObjectContainer is pinned.
 Lock lock()
           
 int lockLevel(Transaction ta)
           
 long modTime()
          Returns the time when the container was last commited with lock level greater than Lock.LEVEL_READ.
 java.lang.String name()
           
 void nameTarget(java.lang.String _name)
           
 void notifyAllTAs(Transaction ta)
           
 Permissions permissions()
           
 void pin()
          Pins this ObjectContainer.
 void readExternal(java.io.ObjectInput in)
           
 void setCluster(Cluster cluster)
           
 void setName(java.lang.String _name)
           
 void setTarget(org.ozoneDB.OzoneCompatible _target)
           
 org.ozoneDB.OzoneCompatible target()
           
 java.lang.Class targetClass()
          Returns the Class for the target object.
 java.lang.String toString()
           
 void touch()
           
 void unpin()
          Unpins this ObjectContainer.
 void writeExternal(java.io.ObjectOutput out)
           
 
Methods inherited from class org.ozoneDB.core.storage.StorageObjectContainer
equals, updateLockLevel
 
Methods inherited from class org.ozoneDB.core.AbstractObjectContainer
clearState, constructorFor, createTarget, database, flushMethodCache, getCurrentDatabase, getCurrrentTransaction, getEnv, invokeOnPassivate, invokeTarget, methodFor, ozoneProxy, raiseState, requireWriteLocking, setShouldCallOnActivate, setShouldCallOnPassivate, shouldOnActivateBeCalled, shouldOnPassivateBeCalled, state, targetClone
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

serialVersionUID

protected static final long serialVersionUID
See Also:
Constant Field Values

subSerialVersionUID

protected static final byte subSerialVersionUID
See Also:
Constant Field Values

target

protected org.ozoneDB.OzoneCompatible target
The currently commited target object of the container.


objID

protected ObjectID objID

name

protected java.lang.String name

invokeCount

protected transient int invokeCount

modTime

protected long modTime

garbageCollectionLevel

protected int garbageCollectionLevel
The garbage collection level of this ObjectContainer. This number is compared to the currentGarbageCollectionLevel of the database. Is this number smaller, then this object may be reachable. Is it equal, then this object is reachable, but it's descendants are not yet considered. Is it greater, then this object is reachable and this object is processed, it's descendants have been considered. At the end of the mark-process, every object which still is not reachable must be unreachable, so at this and, a smaller garbageCollectionLevel than currentGarbageCollectionLevel means that this object may be deleted.

Constructor Detail

WizardObjectContainer

public WizardObjectContainer()
Constructor for object serialization via Externalizable.


WizardObjectContainer

public WizardObjectContainer(ObjectID _objID)
Method Detail

setCluster

public void setCluster(Cluster cluster)
Overrides:
setCluster in class StorageObjectContainer

getCluster

public Cluster getCluster()
Overrides:
getCluster in class StorageObjectContainer

modTime

public long modTime()
Description copied from interface: ObjectContainer
Returns the time when the container was last commited with lock level greater than Lock.LEVEL_READ. The value returned by this method should only be compared against return values of this method.


isDeleted

public boolean isDeleted()
Specified by:
isDeleted in class StorageObjectContainer

isCreated

protected boolean isCreated()

targetClass

public java.lang.Class targetClass()
Returns the Class for the target object. This method is used by AbstractObjectContainer.


setTarget

public void setTarget(org.ozoneDB.OzoneCompatible _target)

target

public org.ozoneDB.OzoneCompatible target()

touch

public void touch()

lock

public Lock lock()

notifyAllTAs

public void notifyAllTAs(Transaction ta)

permissions

public Permissions permissions()

lockLevel

public int lockLevel(Transaction ta)

isInvoked

public boolean isInvoked()
Specified by:
isInvoked in class StorageObjectContainer

invokeTarget

public java.lang.Object invokeTarget(Env env,
                                     java.lang.String methodName,
                                     java.lang.String sig,
                                     java.lang.Object[] args)
                              throws java.lang.Exception
Specified by:
invokeTarget in interface ObjectContainer
Overrides:
invokeTarget in class AbstractObjectContainer
Throws:
java.lang.Exception

invokeOnActivate

public void invokeOnActivate()
Specified by:
invokeOnActivate in interface ObjectContainer
Overrides:
invokeOnActivate in class AbstractObjectContainer

deleteTarget

public void deleteTarget()

nameTarget

public void nameTarget(java.lang.String _name)

allLockers

public DxCollection allLockers()
Description copied from interface: Lockable
Returns a collection of Locker objects that currently lock this Lockable object.


id

public ObjectID id()

name

public java.lang.String name()

setName

public void setName(java.lang.String _name)

writeExternal

public void writeExternal(java.io.ObjectOutput out)
                   throws java.io.IOException
Throws:
java.io.IOException

readExternal

public void readExternal(java.io.ObjectInput in)
                  throws java.io.IOException,
                         java.lang.ClassNotFoundException
Throws:
java.io.IOException
java.lang.ClassNotFoundException

ensureGarbageCollectionLevel

public int ensureGarbageCollectionLevel(int newGarbageCollectionLevel)
Ensures that the garbageCollectionLevel is at least the given currentGarbageCollectionLevel. The return value is meaningful if the supplied newGarbageCollectionLevel is the currentGarbageCollectionLevel

Returns:
<=0 if this object still has to be processed. This is the case if it belongs to the surelyReachable set but not to the processedReachable set > otherwise <0 if this object has been updated =0 if this object has not been updated, it is surelyReachable >0 if this object has not been updated, it is processedReachable

getGarbageCollectionLevel

public int getGarbageCollectionLevel()
Returns the garbageCollectionLevel this ObjectContainer has reached due to (not) calling ensureGarbageCollectionLevel(int).


pin

public void pin()
Pins this ObjectContainer. Every caller of this method must pair this call with a call to unpin(). An ObjectContainer remains in main memory at least as long as it is pinned.


unpin

public void unpin()
Unpins this ObjectContainer. This method must be called exactly once for every call to pin().


isPinned

public boolean isPinned()
Returns wether this ObjectContainer is pinned.


hasSameClusterAs

public boolean hasSameClusterAs(WizardObjectContainer container)

toString

public java.lang.String toString()

ozone core API

Copyright (C) The Ozone Database Project - www.ozone-db.org. All rights reserved.