Class Latches


  • public class Latches
    extends Object
    Factory methods for various distributed countdown latch implementations.
    Since:
    21.12
    Author:
    as, lh 2021.11.17
    • Field Detail

      • SESSION_NAME

        public static final String SESSION_NAME
        The session name.
    • Constructor Detail

      • Latches

        public Latches()
    • Method Detail

      • remoteCountDownLatch

        public static RemoteCountDownLatch remoteCountDownLatch​(String sName,
                                                                int count)
        Return a singleton instance of a RemoteCountDownLatch with a specified name and count.
        Parameters:
        sName - the cluster-wide, unique name of the countdown latch
        count - the initial count of the countdown latch
        Returns:
        an instance of a RemoteCountDownLatch with a specified name and count
      • localCountDownLatch

        public static LocalCountDownLatch localCountDownLatch​(String sName,
                                                              int count)
        Return a singleton instance of a LocalCountDownLatch with a specified name and initial count.

        The specified latch count is only relevant during the initial latch creation, and is ignored if the latch already exists in the current process. That means that the returned latch instance could have a different count from the one requested.

        Parameters:
        sName - the process-wide, unique name of the latch
        count - the initial latch count; ignored if the latch already exists
        Returns:
        an instance of a local countdown latch with a specified name
      • removeCountDownLatch

        protected static void removeCountDownLatch​(String sName)
        Remove the named countdown latch.
        Parameters:
        sName - the name of the latch
      • session

        protected static Session session()
        Return Coherence Session for the Latches module.
        Returns:
        Coherence Session for the Latches module
      • latchesMap

        protected static NamedMap<String,​com.oracle.coherence.concurrent.internal.LatchCounter> latchesMap()
        Return Coherence NamedMap containing the countdown latches state.
        Returns:
        Coherence NamedMap containing the countdown latches state