|
ozone core API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.ozoneDB.core.ServerComponent
org.ozoneDB.core.GarbageCollector
Marks reachable objects and sweeps unreachable objects.
surelyReachableObjectsWhichHaveToBeMarkedAsSuch
may grow to the count of objects.
Possible solutions are:
Nested Class Summary | |
class |
GarbageCollector.GarbageCollectorProxyObjectIdentificationObjectOutputStream
ObjectOutputStream which servers as an intra ObjectContainer object-graph-walker to detect all OzoneProxy instances an OzoneObject does refer. |
Field Summary | |
protected int |
actionsWithinTransactionCount
The count of actions which were done within this garbageCollector. |
protected int |
currentGarbageCollectionLevel
The number which represents the current garbage collection run. |
protected int |
doneReachableGarbageCollectionLevel
The garbageCollectionLevel which objects have if they belong to the doneReachable set. |
protected java.lang.Object |
garbageCollectionLevelsLock
This is the lock that everybody has to be synchronized to in order to be able to access any garbageCollectionLevel in any object within this database. |
protected java.lang.Thread |
garbageCollectionThread
The thread which actually does the work. |
protected boolean |
kill
Wether we should stop running as soon as possible. |
protected int |
phase
The current phase this GarbageCollector is in. |
protected static int |
PHASE_IDLE
Doing nothing |
protected static int |
PHASE_MARKING
We are started, we are marking all reachable objects |
protected static int |
PHASE_MARKING2
We are started, we are marking all reachable objects |
protected static int |
PHASE_READY_TO_START
We may start, all old transactions are complete |
protected static int |
PHASE_RUN_INITIATED
A run has been initiated |
protected static int |
PHASE_SWEEPING
We are started, we are sweeping all unreachable objects |
protected static int |
PHASE_WAITING_FOR_NEW_TRANSACTIONS_TO_COMPLETE
Waiting for the old transactions to complete |
protected static int |
PHASE_WAITING_FOR_OLD_TRANSACTIONS_TO_COMPLETE
Waiting for the old transactions to complete |
protected org.ozoneDB.data.SimpleArrayList |
surelyReachableObjectsWhichHaveToBeMarkedAsSuch
A stack of ObjectIDs of objects, which are surely reachable, but still were not marked as such. |
protected java.util.LinkedList |
surelyReachableObjectsWhichShouldHaveBeenProcessedButWereLockContented
The list of ObjectIDs of objects which are surelyReachable and already were tried to be processed but where locking the objects failed. |
protected Transaction |
transaction
The current transaction of this garbageCollector. |
protected java.util.HashSet |
transactionsRequiredToComplete
The list of Transaction s, which have to be completed before the GarbageCollector
may start. |
Fields inherited from class org.ozoneDB.core.ServerComponent |
env |
Constructor Summary | |
protected |
GarbageCollector(Env env)
Creates a new garbage collector. |
Method Summary | |
protected void |
addAllNamedObjectsToSurelyReachableSet()
This method walks through all named objects and adds each of them to the surelyReachable set. |
protected void |
addObjectIDToSurelyReachableObjectsWhichHaveToBeMarkedAsSuch(ObjectID id)
This method may be called both from transaction threads and from GarbageCollector-Threads. |
protected void |
addRootSetElementsToSurelyReachableSet()
|
void |
addTransactionRequiredToComplete(java.lang.Object ta)
|
protected void |
checkForEndOfWaitForCurrentTransactionsToCompletePhase()
|
protected void |
checkForProxyBorderCross(java.lang.Object o)
This method checks wether the given object or the object graph reachable from this given object contains OzoneProxys. |
protected void |
checkForProxyBorderCross(org.ozoneDB.OzoneCompatible o)
This method checks wether the given object or the object graph reachable from this given object contains OzoneProxys. |
protected void |
checkForProxyBorderCross(org.ozoneDB.OzoneProxy o)
This method checks wether the given object or the object graph reachable from this given object contains OzoneProxys. |
protected void |
completeTransaction()
Completes the current transaction and releases it. |
protected void |
deferProcessingOfObjectContainerDueToLockContention(ObjectContainer objectContainer)
Defers the processing of the given objectContainer because locking was not possible at current time. |
protected void |
ensureDoneReachable(ObjectContainer objectContainer)
Ensures that the given object is doneReachable. |
protected void |
ensureSurelyReachable(ObjectContainer objectContainer)
Calling this method makes sure that the object which is referenced by the given ID is at least surely reachable. |
protected void |
ensureSurelyReachable(ObjectID id)
Calling this method makes sure that the object which is referenced by the given ID is at least surely reachable. |
protected void |
incCurrentGarbageCollectorLevel()
|
void |
interceptInvocationPost(Transaction transaction,
ObjectContainer callee,
java.lang.Object result)
This method is called by Transactions to indicate that a method of the object callee was called by the transaction. |
void |
interceptInvocationPre(Transaction transaction,
ObjectContainer callee,
java.lang.Object[] args)
This method is called by Transactions to indicate that a method of the object callee will be called by the transaction. |
protected void |
internalAbortTransaction(Transaction transaction)
|
protected void |
internalCompleteTransaction(Transaction transaction)
|
protected void |
internalEnsureDoneReachable(ObjectContainer objectContainer)
Internally ensures that the given object is doneReachable. |
protected int |
internalEnsureSurelyReachable(ObjectContainer objectContainer)
Internally ensures that the given object is at least surelyReachable. |
protected void |
internalFinishTransaction(Transaction transaction)
|
protected boolean |
isRunning()
Returns wether this GarbageCollector is running. |
protected void |
notifyAboutTransactionActionAndRenewTransactionIfRequired()
|
void |
notifyDatabaseObjectIsAboutToBeExported(ObjectID id)
This method is called by DbInvokeClient to notify this garbageCollector that there is a reference which is to be exported to a client. |
void |
notifyDatabaseObjectIsExported(ObjectID id)
|
protected void |
notifyEndOfWaitForCurrentTransactionsToCompletePhase()
Informs this GarbageCollector, the the pre-phase is done, there are no transactions that are older than this garbage collector run. |
void |
notifyNamedObject(ObjectID id)
This method is called by StoreManager to indicate that the object with the given id is a named object. |
void |
notifyNewObjectContainer(ObjectContainer objectContainer)
This method is called by StoreManager in the event an object is freshly created. |
void |
notifyNewObjectName(ObjectContainer objectContainer)
This method is called by StoreManager in the event an unnamed object receives a name. |
protected void |
processObjectContainerWhichWantsToBeSurelyReachable(Transaction transaction,
ObjectContainer objectContainer)
Processes an ObjectContainer which possibly has not already been registered as surely reachable. |
protected void |
processReferencesByThisObject(Transaction transaction,
ObjectContainer objectContainer)
Determines all references which are "contained" within the given object, adds them to the list of surelyReachableObjectsWhichHaveToBeMarkedAsSuch
and then marks the given object as doneReachable.
|
protected void |
processSurelyReachableObjectsWhichHaveToBeMarkedAsSuch()
This is the "main()" method of the mark phase. |
void |
removeTransactionRequiredToComplete(Transaction ta)
|
protected void |
renewTransactionIfRequired()
Checks wether the current transaction has to be committed (because it accumulated too much changes) and if so, commits it and closes it. |
void |
run()
The main method for garbage collection. |
void |
save()
Save the internal state in the state to the server state properties. |
protected void |
setCurrentGarbageCollectionLevel(int to)
|
protected void |
setPhase(int to)
|
void |
shutdown()
|
void |
start()
Starts the garbage collection process. |
protected void |
startFilterDatabaseObjectReferencesAtExternalDatabaseGates()
|
void |
startup()
Start up and load the internal state from the server state properties. |
protected void |
sweepUnreachableObjects()
Sweeps all objects which are considered unreachable. |
protected void |
waitForPhase(int newPhase)
|
Methods inherited from class org.ozoneDB.core.ServerComponent |
clearChanged, hasChanged, setChanged |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected java.lang.Thread garbageCollectionThread
protected java.util.HashSet transactionsRequiredToComplete
Transaction
s, which have to be completed before the GarbageCollector
may start. It may not start earlier because the rollback of those transaction may make
objects live which were believed to be dead.
protected int currentGarbageCollectionLevel
WizardObjectContainer.garbageCollectionLevel
.
There are tree sets of database objects
protected int doneReachableGarbageCollectionLevel
currentGarbageCollectionLevel
+1
protected int phase
protected static final int PHASE_IDLE
protected static final int PHASE_RUN_INITIATED
protected static final int PHASE_WAITING_FOR_OLD_TRANSACTIONS_TO_COMPLETE
protected static final int PHASE_READY_TO_START
protected static final int PHASE_MARKING
protected static final int PHASE_WAITING_FOR_NEW_TRANSACTIONS_TO_COMPLETE
protected static final int PHASE_MARKING2
protected static final int PHASE_SWEEPING
protected Transaction transaction
protected int actionsWithinTransactionCount
protected org.ozoneDB.data.SimpleArrayList surelyReachableObjectsWhichHaveToBeMarkedAsSuch
protected java.util.LinkedList surelyReachableObjectsWhichShouldHaveBeenProcessedButWereLockContented
surelyReachableObjectsWhichHaveToBeMarkedAsSuch
protected java.lang.Object garbageCollectionLevelsLock
protected boolean kill
Constructor Detail |
protected GarbageCollector(Env env)
Method Detail |
protected void setCurrentGarbageCollectionLevel(int to)
public void startup()
ServerComponent
startup
in class ServerComponent
public void shutdown()
shutdown
in class ServerComponent
public void save()
ServerComponent
save
in class ServerComponent
public void start()
public void addTransactionRequiredToComplete(java.lang.Object ta)
public void removeTransactionRequiredToComplete(Transaction ta)
protected void checkForEndOfWaitForCurrentTransactionsToCompletePhase()
protected void notifyEndOfWaitForCurrentTransactionsToCompletePhase()
protected void incCurrentGarbageCollectorLevel()
public void run()
run
in interface java.lang.Runnable
protected void notifyAboutTransactionActionAndRenewTransactionIfRequired() throws java.io.IOException, java.lang.ClassNotFoundException, org.ozoneDB.TransactionException
java.io.IOException
java.lang.ClassNotFoundException
org.ozoneDB.TransactionException
protected void renewTransactionIfRequired() throws java.io.IOException, java.lang.ClassNotFoundException, org.ozoneDB.TransactionException
java.io.IOException
java.lang.ClassNotFoundException
org.ozoneDB.TransactionException
protected void completeTransaction() throws java.io.IOException, java.lang.ClassNotFoundException
java.io.IOException
java.lang.ClassNotFoundException
protected void internalCompleteTransaction(Transaction transaction) throws java.io.IOException, java.lang.ClassNotFoundException
java.io.IOException
java.lang.ClassNotFoundException
protected void internalFinishTransaction(Transaction transaction) throws java.io.IOException, java.lang.ClassNotFoundException
java.io.IOException
java.lang.ClassNotFoundException
protected void internalAbortTransaction(Transaction transaction) throws java.io.IOException, java.lang.ClassNotFoundException
java.io.IOException
java.lang.ClassNotFoundException
protected void setPhase(int to)
protected void waitForPhase(int newPhase) throws java.lang.InterruptedException
java.lang.InterruptedException
protected void addRootSetElementsToSurelyReachableSet()
protected void startFilterDatabaseObjectReferencesAtExternalDatabaseGates()
public void notifyDatabaseObjectIsExported(ObjectID id)
public void notifyDatabaseObjectIsAboutToBeExported(ObjectID id)
protected void addAllNamedObjectsToSurelyReachableSet()
public void notifyNamedObject(ObjectID id)
public void notifyNewObjectName(ObjectContainer objectContainer)
public void notifyNewObjectContainer(ObjectContainer objectContainer)
protected void ensureSurelyReachable(ObjectID id)
protected void addObjectIDToSurelyReachableObjectsWhichHaveToBeMarkedAsSuch(ObjectID id)
protected void ensureSurelyReachable(ObjectContainer objectContainer)
protected boolean isRunning()
protected void processSurelyReachableObjectsWhichHaveToBeMarkedAsSuch()
protected int internalEnsureSurelyReachable(ObjectContainer objectContainer)
protected void ensureDoneReachable(ObjectContainer objectContainer)
protected void internalEnsureDoneReachable(ObjectContainer objectContainer)
protected void processObjectContainerWhichWantsToBeSurelyReachable(Transaction transaction, ObjectContainer objectContainer)
transaction
- objectContainer
- protected void processReferencesByThisObject(Transaction transaction, ObjectContainer objectContainer)
surelyReachableObjectsWhichHaveToBeMarkedAsSuch
and then marks the given object as doneReachable.
This method may be called by any CommandThread.
protected void deferProcessingOfObjectContainerDueToLockContention(ObjectContainer objectContainer)
public void interceptInvocationPre(Transaction transaction, ObjectContainer callee, java.lang.Object[] args)
public void interceptInvocationPost(Transaction transaction, ObjectContainer callee, java.lang.Object result)
protected void checkForProxyBorderCross(java.lang.Object o)
protected void checkForProxyBorderCross(org.ozoneDB.OzoneProxy o)
protected void checkForProxyBorderCross(org.ozoneDB.OzoneCompatible o)
protected void sweepUnreachableObjects()
|
ozone core API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |