Package com.sun.xml.ws.api.ha
Enum HighAvailabilityProvider
- All Implemented Interfaces:
Serializable
,Comparable<HighAvailabilityProvider>
Singleton high-availability provider for Metro
- Author:
- Marek Potociar (marek.potociar at sun.com)
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic enum
Enumeration of supported backing store factory types -
Enum Constant Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
close
(BackingStore<?, ?> backingStore) Helper method that avoids the need for exception handling boilerplate code when closing aBackingStore
instance.<K extends Serializable,
V extends Serializable>
BackingStore<K,V> createBackingStore
(BackingStoreFactory factory, String backingStoreName, Class<K> keyClass, Class<V> valueClass) Helper method that avoids the need for exception handling boilerplate code when creating a newBackingStore
instance.static void
destroy
(BackingStore<?, ?> backingStore) Helper method that avoids the need for exception handling boilerplate code when destroying aBackingStore
instance.RetrievesBackingStoreFactory
implementation of the requested type.<K extends Serializable,
V extends Serializable>
BackingStoreConfiguration<K,V> initBackingStoreConfiguration
(String storeName, Class<K> keyClass, Class<V> valueClass) CreatesBackingStoreConfiguration
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 MetroHighAvailabilityProvider
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>
VloadFrom
(BackingStore<K, V> backingStore, K key, String version) Helper method that avoids the need for exception handling boilerplate code when loading data from aBackingStore
instance.static <K extends Serializable>
voidremoveExpired
(BackingStore<K, ?> backingStore) Helper method that avoids the need for exception handling boilerplate code when destroying aBackingStore
instance.static <K extends Serializable,
V extends Serializable>
voidremoveFrom
(BackingStore<K, V> backingStore, K key) Helper method that avoids the need for exception handling boilerplate code when removing data from aBackingStore
instance.static <K extends Serializable,
V extends Serializable>
StringsaveTo
(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 aBackingStore
instance.static HighAvailabilityProvider
Returns 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 MetroHighAvailabilityProvider
class. It is primarily used by a container to inject the proper cluster name and instance name values that are later used to initialize allBackingStoreConfiguration
instances 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> BackingStoreConfiguration<K,V> initBackingStoreConfiguration(String storeName, Class<K> keyClass, Class<V> valueClass) CreatesBackingStoreConfiguration
instance initialized with all mandatory fields. This instance can be used to createBackingStore
instance.- 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
BackingStoreConfiguration
instance
-
getBackingStoreFactory
public BackingStoreFactory getBackingStoreFactory(HighAvailabilityProvider.StoreType type) throws HighAvailabilityProviderException RetrievesBackingStoreFactory
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 theBackingStoreFactory
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 requestedBackingStoreFactory
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> BackingStore<K,V> createBackingStore(BackingStoreFactory factory, String backingStoreName, Class<K> keyClass, Class<V> valueClass) Helper method that avoids the need for exception handling boilerplate code when creating a newBackingStore
instance. The original checkedBackingStoreException
is wrapped into a new uncheckedHighAvailabilityProviderException
.- Type Parameters:
K
- backing store key parameter typeV
- backing store value parameter type- Parameters:
factory
-BackingStoreFactory
instancebackingStoreName
- name of the backing store to be createdkeyClass
- backing store key classvalueClass
- backing store value class- Returns:
- newly created
BackingStore
instance.
-
loadFrom
public static <K extends Serializable,V extends Serializable> V loadFrom(BackingStore<K, V> backingStore, K key, String version) Helper method that avoids the need for exception handling boilerplate code when loading data from aBackingStore
instance. The original checkedBackingStoreException
is wrapped into a new uncheckedHighAvailabilityProviderException
.- Type Parameters:
K
- backing store key parameter typeV
- backing store data parameter type- Parameters:
backingStore
-BackingStore
instancekey
- 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(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 aBackingStore
instance. The original checkedBackingStoreException
is wrapped into a new uncheckedHighAvailabilityProviderException
.- Type Parameters:
K
- backing store key parameter typeV
- backing store value parameter type- Parameters:
backingStore
-BackingStore
instancekey
- 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(BackingStore<K, V> backingStore, K key) Helper method that avoids the need for exception handling boilerplate code when removing data from aBackingStore
instance. The original checkedBackingStoreException
is wrapped into a new uncheckedHighAvailabilityProviderException
.- Type Parameters:
K
- backing store key parameter typeV
- backing store data parameter type- Parameters:
backingStore
-BackingStore
instancekey
- stored data identifier
-
close
Helper method that avoids the need for exception handling boilerplate code when closing aBackingStore
instance. The original checkedBackingStoreException
is wrapped into a new uncheckedHighAvailabilityProviderException
.- Parameters:
backingStore
-BackingStore
instance
-
destroy
Helper method that avoids the need for exception handling boilerplate code when destroying aBackingStore
instance. The original checkedBackingStoreException
is wrapped into a new uncheckedHighAvailabilityProviderException
.- Parameters:
backingStore
-BackingStore
instance
-
removeExpired
Helper method that avoids the need for exception handling boilerplate code when destroying aBackingStore
instance. The original checkedBackingStoreException
is wrapped into a new uncheckedHighAvailabilityProviderException
.- Parameters:
backingStore
-BackingStore
instance
-