messif.buckets.impl
Class MemoryStorageIDBucket
java.lang.Object
messif.buckets.Bucket
messif.buckets.LocalBucket
messif.buckets.OrderedLocalBucket<UniqueID>
messif.buckets.impl.MemoryStorageIDBucket
- All Implemented Interfaces:
- java.io.Serializable, ObjectProvider<LocalAbstractObject>
public class MemoryStorageIDBucket
- extends OrderedLocalBucket<UniqueID>
- implements java.io.Serializable
A volatile implementation of LocalBucket
.
It stores all objects in a memory storage
.
Objects are indexed by their object IDs
and
iterator will return the objects ordered.
This bucket has an efficient LocalBucket.getObject(messif.objects.UniqueID)
implementation
at the cost of additional memory overhead for maintaining the index.
If fast getObject
implementation is not required and
the iteration over all objects is used frequently, consider using
MemoryStorageBucket
.
- See Also:
BucketDispatcher
,
LocalBucket
,
Serialized Form
Constructor Summary |
MemoryStorageIDBucket(long capacity,
long softCapacity,
long lowOccupation,
boolean occupationAsBytes)
Constructs a new instance of MemoryStorageIDBucket. |
Methods inherited from class messif.buckets.LocalBucket |
addObject, addObject, addObjectErrCode, deleteAllObjects, deleteObject, deleteObject, deleteObject, deregisterFilter, getAllObjects, getBucketID, getCapacity, getFilter, getLowOccupation, getObject, getObject, getObject, getObjectCount, getOccupation, getOccupationRatio, getSoftCapacity, isBucketStandalone, isSoftCapacityExceeded, registerFilter, setLowOccupation, setSoftCapacity, toString |
Methods inherited from class java.lang.Object |
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
objects
protected ModifiableOrderedIndex<UniqueID,LocalAbstractObject> objects
- Object storage with object-id index
MemoryStorageIDBucket
public MemoryStorageIDBucket(long capacity,
long softCapacity,
long lowOccupation,
boolean occupationAsBytes)
- Constructs a new instance of MemoryStorageIDBucket.
- Parameters:
capacity
- maximal capacity of the bucket - cannot be exceededsoftCapacity
- maximal soft capacity of the bucketlowOccupation
- a minimal occupation for deleting objects - cannot be loweredoccupationAsBytes
- flag whether the occupation (and thus all the limits) are in bytes or number of objects
getModifiableIndex
protected ModifiableOrderedIndex<UniqueID,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 OrderedLocalBucket<UniqueID>
- 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