ozone core API

org.ozoneDB.core.wizardStore
Class Cluster

java.lang.Object
  |
  +--org.ozoneDB.core.wizardStore.Cluster
All Implemented Interfaces:
java.io.Externalizable, java.io.Serializable

public final class Cluster
extends java.lang.Object
implements java.io.Externalizable

Version:
$Revision: 1.2 $Date: 2002/06/08 00:49:39 $
Author:
SMB
, Medium.net
See Also:
Serialized Form

Field Summary
protected  int bytesPerContainer
           
protected  ClusterID clusterID
           
protected  ClusterStore clusterStore
           
protected  DxMap containers
          Maps ObjectIDs into WizardObjectContainers.
protected  Env env
          The environment.
protected  long lastTouched
           
protected  Lock lock
           
protected  long modTime
           
protected  Permissions permissions
           
protected  int pinCount
          The count of users of this cluster which requested it to be pinned.
protected static long serialVersionUID
           
protected static byte subSerialVersionUID
           
 
Constructor Summary
Cluster()
          Constructor to be used for Externalizable object serialisation.
Cluster(ClusterID _clusterID, Permissions _permissions, Lock _lock, int _bpc)
           
 
Method Summary
 void abort(Transaction ta)
           
 void addPinCount(int what)
          Adds an amount to the pin count
protected  DxCollection allLockers()
           
protected  DxLong cachePriority()
          Priority of this cluster to stay in the cluster cache.
 int clearPinCount()
          Sets the pin count to zero and returns the former pin count.
 ClusterID clusterID()
           
 void commit(Transaction ta)
           
 WizardObjectContainer containerForID(ObjectID id)
           
protected  void delete()
          Delete this cluster from the disk.
protected  void deleteShadow()
           
 void finalize()
           
protected  Lock getLock()
           
 boolean isInvoked()
           
 boolean isPinned()
          Returns wether this cluster is pinned.
 long modTime()
           
 void pin()
          Pins this Cluster.
 void prepareCommit(Transaction ta)
           
 void readExternal(java.io.ObjectInput in)
           
 void registerContainer(WizardObjectContainer container)
           
 void removeContainer(WizardObjectContainer container)
           
protected  void restoreShadow()
          Restore the saved shadow on disk.
protected  void saveShadow()
           
 void setCurrentSize(int byteSize)
           
protected  void setLock(Lock to)
           
 int size()
           
 java.lang.String toString()
           
 void touch()
           
 void unpin()
          Unpins this Cluster.
 void updateLockLevel(Transaction ta)
          Note: This method must not be synchronized.
 void writeExternal(java.io.ObjectOutput out)
           
 
Methods inherited from class java.lang.Object
clone, equals, 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

env

protected transient Env env
The environment. Will be set by the clusterStore.


clusterStore

protected transient ClusterStore clusterStore

clusterID

protected ClusterID clusterID

containers

protected DxMap containers
Maps ObjectIDs into WizardObjectContainers.


permissions

protected Permissions permissions

lock

protected transient Lock lock

lastTouched

protected transient long lastTouched

bytesPerContainer

protected transient int bytesPerContainer

modTime

protected long modTime

pinCount

protected transient int pinCount
The count of users of this cluster which requested it to be pinned. If a cluster is pinned, it may not be "passivated" (i.e. written to disk and forgotten), it has to stay in memory. This cluster is said to be pinned iff pinCount!=0. Access to this count is only allowed during synchronization on this Cluster.

Constructor Detail

Cluster

public Cluster()
Constructor to be used for Externalizable object serialisation.


Cluster

public Cluster(ClusterID _clusterID,
               Permissions _permissions,
               Lock _lock,
               int _bpc)
Method Detail

finalize

public void finalize()
Overrides:
finalize in class java.lang.Object

modTime

public long modTime()

cachePriority

protected DxLong cachePriority()
Priority of this cluster to stay in the cluster cache. Low return value means low priority.

Returns:
Cache priority of the cluster.

setCurrentSize

public void setCurrentSize(int byteSize)

size

public int size()

clusterID

public ClusterID clusterID()

isInvoked

public boolean isInvoked()
Returns:
True if at least one container is currently invoked.

touch

public void touch()

registerContainer

public void registerContainer(WizardObjectContainer container)

removeContainer

public void removeContainer(WizardObjectContainer container)

containerForID

public WizardObjectContainer containerForID(ObjectID id)

updateLockLevel

public void updateLockLevel(Transaction ta)
                     throws java.io.IOException
Note: This method must not be synchronized.

Parameters:
ta -
java.io.IOException

prepareCommit

public void prepareCommit(Transaction ta)

commit

public void commit(Transaction ta)
            throws java.io.IOException
java.io.IOException

abort

public void abort(Transaction ta)
           throws java.io.IOException
java.io.IOException

allLockers

protected DxCollection allLockers()

saveShadow

protected void saveShadow()
                   throws java.io.IOException
java.io.IOException

restoreShadow

protected void restoreShadow()
                      throws java.io.IOException
Restore the saved shadow on disk. The content of the receiver stays the same. The cluster needs to be re-loaded to reflect the changes.

java.io.IOException

deleteShadow

protected void deleteShadow()
                     throws java.io.IOException
java.io.IOException

delete

protected void delete()
               throws java.lang.Exception
Delete this cluster from the disk.

java.lang.Exception

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getLock

protected Lock getLock()

setLock

protected void setLock(Lock to)

writeExternal

public void writeExternal(java.io.ObjectOutput out)
                   throws java.io.IOException
Specified by:
writeExternal in interface java.io.Externalizable
java.io.IOException

readExternal

public void readExternal(java.io.ObjectInput in)
                  throws java.io.IOException,
                         java.io.ObjectStreamException,
                         java.lang.ClassNotFoundException
Specified by:
readExternal in interface java.io.Externalizable
java.io.IOException
java.io.ObjectStreamException
java.lang.ClassNotFoundException

pin

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


unpin

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


isPinned

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


clearPinCount

public int clearPinCount()
Sets the pin count to zero and returns the former pin count.


addPinCount

public void addPinCount(int what)
Adds an amount to the pin count


ozone core API

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