Class BlockAllocatorListeners
java.lang.Object
org.rostore.v2.media.block.allocator.BlockAllocatorListeners
This is the holder of all block allocator's listeners.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddListener(BlockAllocatorListener blockAllocatorListener) Add listener to be notifiedbooleanEnabled if at least one listener is addedvoidnotifyAllocated(String name, BlockType blockType, CatalogBlockIndices catalogBlockIndices, boolean rebalance) Notify all listeners in the collection that a set of new blocks has just been allocatedvoidnotifyFreed(String name, CatalogBlockIndices catalogBlockIndices, boolean rebalance) Notify all listeners in the collection that a set of blocks has just been freedvoidremoveListener(BlockAllocatorListener blockAllocatorListener) Remove the listener, and stop receiving notifications
-
Constructor Details
-
BlockAllocatorListeners
public BlockAllocatorListeners()
-
-
Method Details
-
addListener
Add listener to be notified- Parameters:
blockAllocatorListener- the listener to add
-
removeListener
Remove the listener, and stop receiving notifications- Parameters:
blockAllocatorListener- the listener to disable
-
isEnabled
public boolean isEnabled()Enabled if at least one listener is added- Returns:
trueif at least one listener is added
-
notifyAllocated
public void notifyAllocated(String name, BlockType blockType, CatalogBlockIndices catalogBlockIndices, boolean rebalance) Notify all listeners in the collection that a set of new blocks has just been allocated- Parameters:
name- the name of the allocatorblockType- the type of the allocated blockcatalogBlockIndices- a set of allocated blocksrebalance-trueif allocation has happened in the rebarance=true cycle
-
notifyFreed
Notify all listeners in the collection that a set of blocks has just been freed- Parameters:
name- the name of the allocatorcatalogBlockIndices- a set of allocated blocksrebalance-trueif blocks have been freed in the rebarance=true cycle
-