Interface MonitorQueue


  • public interface MonitorQueue
    A queue for monitors. None of the methods are synchronized. The caller must perform synchronization.
    Author:
    mrk
    • Method Detail

      • clear

        void clear()
        Set all elements free.
      • getNumberFree

        int getNumberFree()
        Get the number of free queue elements.
        Returns:
        the number of free queue elements
      • capacity

        int capacity()
        Get the queue capacity.
        Returns:
        the queue capacity
      • getFree

        MonitorElement getFree()
        Get the next free element.
        Returns:
        the next free element or null if no free elements
      • setUsed

        void setUsed​(MonitorElement monitorElement)
        Set the getFree element to used.
        Parameters:
        monitorElement - the monitorElement, which must be the element returned by the oldest call to getFree that was not setUsed
        Throws:
        IllegalStateException - if monitorElement is not the element returned by the oldest call to getFree that was not setUsed
      • getUsed

        MonitorElement getUsed()
        Get the oldest used element.
        Returns:
        the next used element or null if no used elements
      • releaseUsed

        void releaseUsed​(MonitorElement monitorElement)
        Release the getUsed structure.
        Parameters:
        monitorElement - the monitorElement, which must be the element returned by the most recent call to getUsed
        Throws:
        IllegalStateException - if monitorElement is not the element returned by the most recent call to getUsed