Class Atomics


  • public final class Atomics
    extends Object
    Factory methods for various atomic value implementations.
    Since:
    21.12
    Author:
    Aleks Seovic 2020.12.03
    • Field Detail

      • SESSION_NAME

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

      • localAtomicBoolean

        public static LocalAtomicBoolean localAtomicBoolean​(String sName)
        Return LocalAtomicBoolean instance for the specified name.
        Parameters:
        sName - the name of the atomic value
        Returns:
        a LocalAtomicBoolean instance for the specified name
      • localAtomicBoolean

        public static LocalAtomicBoolean localAtomicBoolean​(String sName,
                                                            boolean fInitialValue)
        Return LocalAtomicBoolean instance for the specified name and initial value.

        The initial value will only be set if the atomic value with the specified name does not already exist.

        Parameters:
        sName - the name of the atomic value
        fInitialValue - the initial value
        Returns:
        a LocalAtomicBoolean instance for the specified name
      • remoteAtomicBoolean

        public static RemoteAtomicBoolean remoteAtomicBoolean​(String sName)
        Return RemoteAtomicBoolean instance for the specified name.
        Parameters:
        sName - the name of the atomic value
        Returns:
        a RemoteAtomicBoolean instance for the specified name
      • remoteAtomicBoolean

        public static RemoteAtomicBoolean remoteAtomicBoolean​(String sName,
                                                              boolean fInitialValue)
        Return RemoteAtomicBoolean instance for the specified name and initial value.

        The initial value will only be set if the atomic value with the specified name does not already exist.

        Parameters:
        sName - the name of the atomic value
        fInitialValue - the initial value
        Returns:
        a RemoteAtomicBoolean instance for the specified name
      • localAtomicInteger

        public static LocalAtomicInteger localAtomicInteger​(String sName)
        Return LocalAtomicInteger instance for the specified name.
        Parameters:
        sName - the name of the atomic value
        Returns:
        a LocalAtomicInteger instance for the specified name
      • localAtomicInteger

        public static LocalAtomicInteger localAtomicInteger​(String sName,
                                                            int nInitialValue)
        Return LocalAtomicInteger instance for the specified name and initial value.

        The initial value will only be set if the atomic value with the specified name does not already exist.

        Parameters:
        sName - the name of the atomic value
        nInitialValue - the initial value
        Returns:
        a LocalAtomicInteger instance for the specified name
      • remoteAtomicInteger

        public static RemoteAtomicInteger remoteAtomicInteger​(String sName)
        Return RemoteAtomicInteger instance for the specified name.
        Parameters:
        sName - the name of the atomic value
        Returns:
        a RemoteAtomicInteger instance for the specified name
      • remoteAtomicInteger

        public static RemoteAtomicInteger remoteAtomicInteger​(String sName,
                                                              int nInitialValue)
        Return RemoteAtomicInteger instance for the specified name and initial value.

        The initial value will only be set if the atomic value with the specified name does not already exist.

        Parameters:
        sName - the name of the atomic value
        nInitialValue - the initial value
        Returns:
        a RemoteAtomicInteger instance for the specified name
      • localAtomicLong

        public static LocalAtomicLong localAtomicLong​(String sName)
        Return LocalAtomicLong instance for the specified name.
        Parameters:
        sName - the name of the atomic value
        Returns:
        a LocalAtomicLong instance for the specified name
      • localAtomicLong

        public static LocalAtomicLong localAtomicLong​(String sName,
                                                      long lInitialValue)
        Return LocalAtomicLong instance for the specified name and initial value.

        The initial value will only be set if the atomic value with the specified name does not already exist.

        Parameters:
        sName - the name of the atomic value
        lInitialValue - the initial value
        Returns:
        a LocalAtomicLong instance for the specified name
      • remoteAtomicLong

        public static RemoteAtomicLong remoteAtomicLong​(String sName)
        Return RemoteAtomicLong instance for the specified name.
        Parameters:
        sName - the name of the atomic value
        Returns:
        a RemoteAtomicLong instance for the specified name
      • remoteAtomicLong

        public static RemoteAtomicLong remoteAtomicLong​(String sName,
                                                        long lInitialValue)
        Return RemoteAtomicLong instance for the specified name and initial value.

        The initial value will only be set if the atomic value with the specified name does not already exist.

        Parameters:
        sName - the name of the atomic value
        lInitialValue - the initial value
        Returns:
        a RemoteAtomicLong instance for the specified name
      • localAtomicReference

        public static <V> LocalAtomicReference<V> localAtomicReference​(String sName)
        Return LocalAtomicReference instance for the specified name.
        Type Parameters:
        V - the type of object referred to by this reference
        Parameters:
        sName - the name of the atomic value
        Returns:
        a LocalAtomicReference instance for the specified name
      • localAtomicReference

        public static <V> LocalAtomicReference<V> localAtomicReference​(String sName,
                                                                       V initialValue)
        Return LocalAtomicReference instance for the specified name and initial value.

        The initial value will only be set if the atomic value with the specified name does not already exist.

        Type Parameters:
        V - the type of object referred to by this reference
        Parameters:
        sName - the name of the atomic value
        initialValue - the initial value
        Returns:
        a LocalAtomicReference instance for the specified name
      • remoteAtomicReference

        public static <V> RemoteAtomicReference<V> remoteAtomicReference​(String sName)
        Return RemoteAtomicReference instance for the specified name.
        Type Parameters:
        V - the type of object referred to by this reference
        Parameters:
        sName - the name of the atomic value
        Returns:
        a RemoteAtomicReference instance for the specified name
      • remoteAtomicReference

        public static <V> RemoteAtomicReference<V> remoteAtomicReference​(String sName,
                                                                         V initialValue)
        Return RemoteAtomicReference instance for the specified name and initial value.

        The initial value will only be set if the atomic value with the specified name does not already exist.

        Type Parameters:
        V - the type of object referred to by this reference
        Parameters:
        sName - the name of the atomic value
        initialValue - the initial value
        Returns:
        a RemoteAtomicReference instance for the specified name
      • localAtomicMarkableReference

        public static <V> LocalAtomicMarkableReference<V> localAtomicMarkableReference​(String sName)
        Return LocalAtomicMarkableReference instance for the specified name.
        Type Parameters:
        V - the type of object referred to by this reference
        Parameters:
        sName - the name of the atomic value
        Returns:
        a LocalAtomicMarkableReference instance for the specified name
      • localAtomicMarkableReference

        public static <V> LocalAtomicMarkableReference<V> localAtomicMarkableReference​(String sName,
                                                                                       V initialValue,
                                                                                       boolean fInitialMark)
        Return LocalAtomicMarkableReference instance for the specified name and initial value and mark.

        The initial value and mark will only be set if the atomic value with the specified name does not already exist.

        Type Parameters:
        V - the type of object referred to by this reference
        Parameters:
        sName - the name of the atomic value
        initialValue - the initial value
        fInitialMark - the initial mark
        Returns:
        a LocalAtomicMarkableReference instance for the specified name
      • remoteAtomicMarkableReference

        public static <V> RemoteAtomicMarkableReference<V> remoteAtomicMarkableReference​(String sName)
        Return RemoteAtomicMarkableReference instance for the specified name.
        Type Parameters:
        V - the type of object referred to by this reference
        Parameters:
        sName - the name of the atomic value
        Returns:
        a RemoteAtomicMarkableReference instance for the specified name
      • remoteAtomicMarkableReference

        public static <V> RemoteAtomicMarkableReference<V> remoteAtomicMarkableReference​(String sName,
                                                                                         V initialValue,
                                                                                         boolean fInitialMark)
        Return RemoteAtomicMarkableReference instance for the specified name and initial value and mark.

        The initial value and mark will only be set if the atomic value with the specified name does not already exist.

        Type Parameters:
        V - the type of object referred to by this reference
        Parameters:
        sName - the name of the atomic value
        initialValue - the initial value
        fInitialMark - the initial mark
        Returns:
        a RemoteAtomicMarkableReference instance for the specified name
      • localAtomicStampedReference

        public static <V> LocalAtomicStampedReference<V> localAtomicStampedReference​(String sName)
        Return LocalAtomicStampedReference instance for the specified name.
        Type Parameters:
        V - the type of object referred to by this reference
        Parameters:
        sName - the name of the atomic value
        Returns:
        a LocalAtomicStampedReference instance for the specified name
      • localAtomicStampedReference

        public static <V> LocalAtomicStampedReference<V> localAtomicStampedReference​(String sName,
                                                                                     V initialValue,
                                                                                     int nInitialStamp)
        Return LocalAtomicStampedReference instance for the specified name and initial value and stamp.

        The initial value and stamp will only be set if the atomic value with the specified name does not already exist.

        Type Parameters:
        V - the type of object referred to by this reference
        Parameters:
        sName - the name of the atomic value
        initialValue - the initial value
        nInitialStamp - the initial stamp
        Returns:
        a LocalAtomicStampedReference instance for the specified name
      • remoteAtomicStampedReference

        public static <V> RemoteAtomicStampedReference<V> remoteAtomicStampedReference​(String sName)
        Return RemoteAtomicStampedReference instance for the specified name.
        Type Parameters:
        V - the type of object referred to by this reference
        Parameters:
        sName - the name of the atomic value
        Returns:
        a RemoteAtomicStampedReference instance for the specified name
      • remoteAtomicStampedReference

        public static <V> RemoteAtomicStampedReference<V> remoteAtomicStampedReference​(String sName,
                                                                                       V initialValue,
                                                                                       int nInitialStamp)
        Return RemoteAtomicStampedReference instance for the specified name and initial value and stamp.

        The initial value and stamp will only be set if the atomic value with the specified name does not already exist.

        Type Parameters:
        V - the type of object referred to by this reference
        Parameters:
        sName - the name of the atomic value
        initialValue - the initial value
        nInitialStamp - the initial stamp
        Returns:
        a RemoteAtomicStampedReference instance for the specified name