Enum HighAvailabilityProvider

    • Method Detail

      • values

        public static HighAvailabilityProvider[] values()
        Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
        for (HighAvailabilityProvider c : HighAvailabilityProvider.values())
            System.out.println(c);
        
        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static HighAvailabilityProvider valueOf​(String name)
        Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
        Parameters:
        name - the name of the enum constant to be returned.
        Returns:
        the enum constant with the specified name
        Throws:
        IllegalArgumentException - if this enum type has no constant with the specified name
        NullPointerException - if the argument is null
      • initHaEnvironment

        public void initHaEnvironment​(String clusterName,
                                      String instanceName)
        This method is not meant to be used directly by the user of the Metro HighAvailabilityProvider class. It is primarily used by a container to inject the proper cluster name and instance name values that are later used to initialize all BackingStoreConfiguration instances created via initBackingStoreConfiguration(String, Class, Class) method
        Parameters:
        clusterName - name of the cluster
        instanceName - name of the cluster instance
      • initHaEnvironment

        public void initHaEnvironment​(String clusterName,
                                      String instanceName,
                                      boolean disableJreplica)
      • isDisabledJreplica

        public boolean isDisabledJreplica()
      • initBackingStoreConfiguration

        public <K extends Serializable,​V extends Serializable> org.glassfish.ha.store.api.BackingStoreConfiguration<K,​V> initBackingStoreConfiguration​(String storeName,
                                                                                                                                                                   Class<K> keyClass,
                                                                                                                                                                   Class<V> valueClass)
        Creates BackingStoreConfiguration instance initialized with all mandatory fields. This instance can be used to create BackingStore instance.
        Type Parameters:
        K - backing store key type
        V - backing store value type
        Parameters:
        storeName - name of the backing store
        keyClass - backing store key class
        valueClass - backing store value class
        Returns:
        initialized BackingStoreConfiguration instance
      • isHaEnvironmentConfigured

        public boolean isHaEnvironmentConfigured()
        Provides information on whether there is a HA service available in the current JVM or not.
        Returns:
        true in case there is a HA service available in the current JVM, false otherwise
      • createBackingStore

        public <K extends Serializable,​V extends Serializable> org.glassfish.ha.store.api.BackingStore<K,​V> createBackingStore​(org.glassfish.ha.store.api.BackingStoreFactory factory,
                                                                                                                                           String backingStoreName,
                                                                                                                                           Class<K> keyClass,
                                                                                                                                           Class<V> valueClass)
        Helper method that avoids the need for exception handling boilerplate code when creating a new BackingStore instance. The original checked BackingStoreException is wrapped into a new unchecked HighAvailabilityProviderException.
        Type Parameters:
        K - backing store key parameter type
        V - backing store value parameter type
        Parameters:
        factory - BackingStoreFactory instance
        backingStoreName - name of the backing store to be created
        keyClass - backing store key class
        valueClass - backing store value class
        Returns:
        newly created BackingStore instance.
      • loadFrom

        public static <K extends Serializable,​V extends Serializable> V loadFrom​(org.glassfish.ha.store.api.BackingStore<K,​V> backingStore,
                                                                                       K key,
                                                                                       String version)
        Helper method that avoids the need for exception handling boilerplate code when loading data from a BackingStore instance. The original checked BackingStoreException is wrapped into a new unchecked HighAvailabilityProviderException.
        Type Parameters:
        K - backing store key parameter type
        V - backing store data parameter type
        Parameters:
        backingStore - BackingStore instance
        key - stored data identifier
        version - stored data version
        Returns:
        stored data as specified by BackingStore.load(java.io.Serializable, String)
      • saveTo

        public static <K extends Serializable,​V extends SerializableString saveTo​(org.glassfish.ha.store.api.BackingStore<K,​V> backingStore,
                                                                                          K key,
                                                                                          V value,
                                                                                          boolean isNew)
        Helper method that avoids the need for exception handling boilerplate code when storing data into a BackingStore instance. The original checked BackingStoreException is wrapped into a new unchecked HighAvailabilityProviderException.
        Type Parameters:
        K - backing store key parameter type
        V - backing store value parameter type
        Parameters:
        backingStore - BackingStore instance
        key - stored data identifier
        value - data to be stored
        isNew - See BackingStore.save(java.io.Serializable, java.io.Serializable, boolean)
        Returns:
        See BackingStore.save(java.io.Serializable, java.io.Serializable, boolean)
      • removeFrom

        public static <K extends Serializable,​V extends Serializable> void removeFrom​(org.glassfish.ha.store.api.BackingStore<K,​V> backingStore,
                                                                                            K key)
        Helper method that avoids the need for exception handling boilerplate code when removing data from a BackingStore instance. The original checked BackingStoreException is wrapped into a new unchecked HighAvailabilityProviderException.
        Type Parameters:
        K - backing store key parameter type
        V - backing store data parameter type
        Parameters:
        backingStore - BackingStore instance
        key - stored data identifier
      • close

        public static void close​(org.glassfish.ha.store.api.BackingStore<?,​?> backingStore)
        Helper method that avoids the need for exception handling boilerplate code when closing a BackingStore instance. The original checked BackingStoreException is wrapped into a new unchecked HighAvailabilityProviderException.
        Parameters:
        backingStore - BackingStore instance
      • destroy

        public static void destroy​(org.glassfish.ha.store.api.BackingStore<?,​?> backingStore)
        Helper method that avoids the need for exception handling boilerplate code when destroying a BackingStore instance. The original checked BackingStoreException is wrapped into a new unchecked HighAvailabilityProviderException.
        Parameters:
        backingStore - BackingStore instance
      • removeExpired

        public static <K extends Serializable> void removeExpired​(org.glassfish.ha.store.api.BackingStore<K,​?> backingStore)
        Helper method that avoids the need for exception handling boilerplate code when destroying a BackingStore instance. The original checked BackingStoreException is wrapped into a new unchecked HighAvailabilityProviderException.
        Parameters:
        backingStore - BackingStore instance