Package com.sun.xml.ws.api.ha
Enum HighAvailabilityProvider
- All Implemented Interfaces:
Serializable,Comparable<HighAvailabilityProvider>
Singleton high-availability provider for Metro
- Author:
- Marek Potociar
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumEnumeration of supported backing store factory types -
Enum Constant Summary
Enum Constants -
Method Summary
Modifier and TypeMethodDescriptionstatic voidclose(org.glassfish.ha.store.api.BackingStore<?, ?> backingStore) Helper method that avoids the need for exception handling boilerplate code when closing aBackingStoreinstance.<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 newBackingStoreinstance.static voiddestroy(org.glassfish.ha.store.api.BackingStore<?, ?> backingStore) Helper method that avoids the need for exception handling boilerplate code when destroying aBackingStoreinstance.org.glassfish.ha.store.api.BackingStoreFactoryRetrievesBackingStoreFactoryimplementation 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) CreatesBackingStoreConfigurationinstance initialized with all mandatory fields.voidinitHaEnvironment(String clusterName, String instanceName) This method is not meant to be used directly by the user of the MetroHighAvailabilityProviderclass.voidinitHaEnvironment(String clusterName, String instanceName, boolean disableJreplica) booleanbooleanProvides information on whether there is a HA service available in the current JVM or not.static <K extends Serializable,V extends Serializable>
VHelper method that avoids the need for exception handling boilerplate code when loading data from aBackingStoreinstance.static <K extends Serializable>
voidremoveExpired(org.glassfish.ha.store.api.BackingStore<K, ?> backingStore) Helper method that avoids the need for exception handling boilerplate code when destroying aBackingStoreinstance.static <K extends Serializable,V extends Serializable>
voidremoveFrom(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 aBackingStoreinstance.static <K extends Serializable,V extends Serializable>
StringsaveTo(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 aBackingStoreinstance.static HighAvailabilityProviderReturns the enum constant of this type with the specified name.static HighAvailabilityProvider[]values()Returns an array containing the constants of this enum type, in the order they are declared.
-
Enum Constant Details
-
INSTANCE
-
-
Method Details
-
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
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 nameNullPointerException- if the argument is null
-
initHaEnvironment
This method is not meant to be used directly by the user of the MetroHighAvailabilityProviderclass. It is primarily used by a container to inject the proper cluster name and instance name values that are later used to initialize allBackingStoreConfigurationinstances created viainitBackingStoreConfiguration(String, Class, Class)method- Parameters:
clusterName- name of the clusterinstanceName- name of the cluster instance
-
initHaEnvironment
-
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) CreatesBackingStoreConfigurationinstance initialized with all mandatory fields. This instance can be used to createBackingStoreinstance.- Type Parameters:
K- backing store key typeV- backing store value type- Parameters:
storeName- name of the backing storekeyClass- backing store key classvalueClass- backing store value class- Returns:
- initialized
BackingStoreConfigurationinstance
-
getBackingStoreFactory
public org.glassfish.ha.store.api.BackingStoreFactory getBackingStoreFactory(HighAvailabilityProvider.StoreType type) throws HighAvailabilityProviderException RetrievesBackingStoreFactoryimplementation of the requested type. In case this method is executed outside an HA environment (e.g. standalone mode),HighAvailabilityProvider.StoreType.NOOPimplementation is returned.- Parameters:
type- type of theBackingStoreFactoryimplementation to be retrieved- Returns:
BackingStoreFactoryimplementation of the requested type. When executed outside HA environment,HighAvailabilityProvider.StoreType.NOOPimplementation is returned.- Throws:
HighAvailabilityProviderException- in case the method is executed inside HA environment and the requestedBackingStoreFactoryimplementation is not available.
-
isHaEnvironmentConfigured
public boolean isHaEnvironmentConfigured()Provides information on whether there is a HA service available in the current JVM or not.- Returns:
truein case there is a HA service available in the current JVM,falseotherwise
-
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 newBackingStoreinstance. The original checkedBackingStoreExceptionis wrapped into a new uncheckedHighAvailabilityProviderException.- Type Parameters:
K- backing store key parameter typeV- backing store value parameter type- Parameters:
factory-BackingStoreFactoryinstancebackingStoreName- name of the backing store to be createdkeyClass- backing store key classvalueClass- backing store value class- Returns:
- newly created
BackingStoreinstance.
-
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 aBackingStoreinstance. The original checkedBackingStoreExceptionis wrapped into a new uncheckedHighAvailabilityProviderException.- Type Parameters:
K- backing store key parameter typeV- backing store data parameter type- Parameters:
backingStore-BackingStoreinstancekey- stored data identifierversion- 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 aBackingStoreinstance. The original checkedBackingStoreExceptionis wrapped into a new uncheckedHighAvailabilityProviderException.- Type Parameters:
K- backing store key parameter typeV- backing store value parameter type- Parameters:
backingStore-BackingStoreinstancekey- stored data identifiervalue- data to be storedisNew- SeeBackingStore.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 aBackingStoreinstance. The original checkedBackingStoreExceptionis wrapped into a new uncheckedHighAvailabilityProviderException.- Type Parameters:
K- backing store key parameter typeV- backing store data parameter type- Parameters:
backingStore-BackingStoreinstancekey- 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 aBackingStoreinstance. The original checkedBackingStoreExceptionis wrapped into a new uncheckedHighAvailabilityProviderException.- Parameters:
backingStore-BackingStoreinstance
-
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 aBackingStoreinstance. The original checkedBackingStoreExceptionis wrapped into a new uncheckedHighAvailabilityProviderException.- Parameters:
backingStore-BackingStoreinstance
-
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 aBackingStoreinstance. The original checkedBackingStoreExceptionis wrapped into a new uncheckedHighAvailabilityProviderException.- Parameters:
backingStore-BackingStoreinstance
-