messif.buckets.impl
Class MemoryStorageBucket

java.lang.Object
  extended by messif.buckets.Bucket
      extended by messif.buckets.LocalBucket
          extended by messif.buckets.impl.MemoryStorageBucket
All Implemented Interfaces:
java.io.Serializable, ObjectProvider<LocalAbstractObject>

public class MemoryStorageBucket
extends LocalBucket
implements java.io.Serializable

A volatile implementation of LocalBucket. It stores all objects in a memory storage and no index is provided for the objects.

See Also:
BucketDispatcher, LocalBucket, Serialized Form

Field Summary
protected  ModifiableIndex<LocalAbstractObject> objects
          Object storage
 
Fields inherited from class messif.buckets.LocalBucket
counterBucketAddObject, counterBucketDelObject, counterBucketRead
 
Constructor Summary
MemoryStorageBucket(long capacity, long softCapacity, long lowOccupation, boolean occupationAsBytes)
          Constructs a new MemoryStorageBucket instance.
 
Method Summary
 void destroy()
          Destroy this bucket.
 void finalize()
          Finalize this bucket.
protected  ModifiableIndex<LocalAbstractObject> getModifiableIndex()
          Returns the index (including storage) for this bucket.
 
Methods inherited from class messif.buckets.LocalBucket
addObject, addObject, addObjectErrCode, deleteAllObjects, deleteObject, deleteObject, deleteObject, deregisterFilter, getAllObjects, getBucketID, getCapacity, getFilter, getIndex, getLowOccupation, getObject, getObject, getObject, getObjectCount, getOccupation, getOccupationRatio, getSoftCapacity, isBucketStandalone, isSoftCapacityExceeded, registerFilter, setLowOccupation, setSoftCapacity, toString
 
Methods inherited from class messif.buckets.Bucket
addObjects, addObjects, deleteObject, deleteObjects, processQuery, provideObjects, split
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

objects

protected final ModifiableIndex<LocalAbstractObject> objects
Object storage

Constructor Detail

MemoryStorageBucket

public MemoryStorageBucket(long capacity,
                           long softCapacity,
                           long lowOccupation,
                           boolean occupationAsBytes)
Constructs a new MemoryStorageBucket instance. It uses an MemoryStorage to actually strore the objects.

Parameters:
capacity - maximal capacity of the bucket - cannot be exceeded
softCapacity - maximal soft capacity of the bucket
lowOccupation - a minimal occupation for deleting objects - cannot be lowered
occupationAsBytes - flag whether the occupation (and thus all the limits) are in bytes or number of objects
Method Detail

getModifiableIndex

protected ModifiableIndex<LocalAbstractObject> getModifiableIndex()
Description copied from class: LocalBucket
Returns the index (including storage) for this bucket. The index provides the access to the underlying storage of objects in this bucket.

Specified by:
getModifiableIndex in class LocalBucket
Returns:
the index for this bucket

finalize

public void finalize()
              throws java.lang.Throwable
Description copied from class: LocalBucket
Finalize this bucket. All transient resources associated with this bucket are released. After this method is called, the bucket methods' behavior is unpredictable. This method is called by the BucketDispatcher when it is finalized.

Overrides:
finalize in class LocalBucket
Throws:
java.lang.Throwable - if there was an error while cleaning

destroy

public void destroy()
             throws java.lang.Throwable
Description copied from class: LocalBucket
Destroy this bucket. This method releases all resources (transient and persistent) associated with this bucket (e.g. the statistics and all objects are deleted). After this method is called, the bucket methods' behavior is unpredictable. This method is called by the BucketDispatcher when the bucket is removed from the dispatcher.

Overrides:
destroy in class LocalBucket
Throws:
java.lang.Throwable - if there was an error while cleaning