Class BlockAllocatorListeners

java.lang.Object
org.rostore.v2.media.block.allocator.BlockAllocatorListeners

public class BlockAllocatorListeners extends Object
This is the holder of all block allocator's listeners.
  • Constructor Details

    • BlockAllocatorListeners

      public BlockAllocatorListeners()
  • Method Details

    • addListener

      public void addListener(BlockAllocatorListener blockAllocatorListener)
      Add listener to be notified
      Parameters:
      blockAllocatorListener - the listener to add
    • removeListener

      public void removeListener(BlockAllocatorListener blockAllocatorListener)
      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:
      true if 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 allocator
      blockType - the type of the allocated block
      catalogBlockIndices - a set of allocated blocks
      rebalance - true if allocation has happened in the rebarance=true cycle
    • notifyFreed

      public void notifyFreed(String name, CatalogBlockIndices catalogBlockIndices, boolean rebalance)
      Notify all listeners in the collection that a set of blocks has just been freed
      Parameters:
      name - the name of the allocator
      catalogBlockIndices - a set of allocated blocks
      rebalance - true if blocks have been freed in the rebarance=true cycle