Class CompoundClosableAllocation

  • All Implemented Interfaces:
    ClosableAllocation, ClosableAllocationOwner

    public class CompoundClosableAllocation
    extends java.lang.Object
    implements ClosableAllocationOwner
    CompoundClosableAllocation represents a collection of ClosableAllocations which share a common lifecycle. It guarantees that allocations are closed in the reverse order in which they were added.
    • Field Detail

      • allocations

        protected java.util.List<ClosableAllocation> allocations
        List of owned ClosableAllocation objects.
    • Constructor Detail

      • CompoundClosableAllocation

        public CompoundClosableAllocation()
    • Method Detail

      • forgetAllocation

        public boolean forgetAllocation​(ClosableAllocation allocation)
        Forgets an allocation without closing it.
        Parameters:
        allocation - the allocation to forget
        Returns:
        whether the allocation was known
      • hasAllocations

        public boolean hasAllocations()
        Returns:
        whether any allocations remain unclosed