Enum HighAvailabilityProvider

java.lang.Object
java.lang.Enum<HighAvailabilityProvider>
com.sun.xml.ws.api.ha.HighAvailabilityProvider
All Implemented Interfaces:
Serializable, Comparable<HighAvailabilityProvider>

public enum HighAvailabilityProvider extends Enum<HighAvailabilityProvider>
Singleton high-availability provider for Metro
Author:
Marek Potociar
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static enum 
    Enumeration of supported backing store factory types
  • Enum Constant Summary

    Enum Constants
    Enum Constant
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    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.
    <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.
    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.
    org.glassfish.ha.store.api.BackingStoreFactory
    Retrieves BackingStoreFactory implementation of the requested type.
    <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.
    void
    initHaEnvironment(String clusterName, String instanceName)
    This method is not meant to be used directly by the user of the Metro HighAvailabilityProvider class.
    void
    initHaEnvironment(String clusterName, String instanceName, boolean disableJreplica)
     
    boolean
     
    boolean
    Provides information on whether there is a HA service available in the current JVM or not.
    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.
    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.
    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.
    static <K extends Serializable, V extends Serializable>
    String
    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.
    Returns the enum constant of this type with the specified name.
    Returns an array containing the constants of this enum type, in the order they are declared.

    Methods inherited from class java.lang.Enum

    clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf

    Methods inherited from class java.lang.Object

    getClass, notify, notifyAll, wait, wait, wait
  • Enum Constant Details

  • Method Details

    • values

      public static HighAvailabilityProvider[] values()
      Returns an array containing the constants of this enum type, in the order they are declared.
      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
    • getBackingStoreFactory

      public org.glassfish.ha.store.api.BackingStoreFactory getBackingStoreFactory(HighAvailabilityProvider.StoreType type) throws HighAvailabilityProviderException
      Retrieves BackingStoreFactory implementation of the requested type. In case this method is executed outside an HA environment (e.g. standalone mode), HighAvailabilityProvider.StoreType.NOOP implementation is returned.
      Parameters:
      type - type of the BackingStoreFactory implementation to be retrieved
      Returns:
      BackingStoreFactory implementation of the requested type. When executed outside HA environment, HighAvailabilityProvider.StoreType.NOOP implementation is returned.
      Throws:
      HighAvailabilityProviderException - in case the method is executed inside HA environment and the requested BackingStoreFactory implementation is not available.
    • 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 Serializable> String 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