public enum HighAvailabilityProvider extends Enum<HighAvailabilityProvider>
Modifier and Type | Class and Description |
---|---|
static class |
HighAvailabilityProvider.StoreType
Enumeration of supported backing store factory types
|
Enum Constant and Description |
---|
INSTANCE |
Modifier and Type | Method and 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> |
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 |
getBackingStoreFactory(HighAvailabilityProvider.StoreType type)
Retrieves
BackingStoreFactory implementation of the requested type. |
<K extends Serializable,V extends Serializable> |
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 |
isDisabledJreplica() |
boolean |
isHaEnvironmentConfigured()
Provides information on whether there is a HA service available in the
current JVM or not.
|
static <K extends Serializable,V extends Serializable> |
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> |
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> |
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> |
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. |
static HighAvailabilityProvider |
valueOf(String name)
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.
|
public static final HighAvailabilityProvider INSTANCE
public static HighAvailabilityProvider[] values()
for (HighAvailabilityProvider c : HighAvailabilityProvider.values()) System.out.println(c);
public static HighAvailabilityProvider valueOf(String name)
name
- the name of the enum constant to be returned.IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is nullpublic void initHaEnvironment(String clusterName, String instanceName)
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)
methodclusterName
- name of the clusterinstanceName
- name of the cluster instancepublic void initHaEnvironment(String clusterName, String instanceName, boolean disableJreplica)
public boolean isDisabledJreplica()
public <K extends Serializable,V extends Serializable> org.glassfish.ha.store.api.BackingStoreConfiguration<K,V> initBackingStoreConfiguration(String storeName, Class<K> keyClass, Class<V> valueClass)
BackingStoreConfiguration
instance initialized with
all mandatory fields. This instance can be used to create BackingStore
instance.K
- backing store key typeV
- backing store value typestoreName
- name of the backing storekeyClass
- backing store key classvalueClass
- backing store value classBackingStoreConfiguration
instancepublic org.glassfish.ha.store.api.BackingStoreFactory getBackingStoreFactory(HighAvailabilityProvider.StoreType type) throws HighAvailabilityProviderException
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.type
- type of the BackingStoreFactory
implementation to be retrievedBackingStoreFactory
implementation of the requested type.
When executed outside HA environment, HighAvailabilityProvider.StoreType.NOOP
implementation
is returned.HighAvailabilityProviderException
- in case the method is executed inside
HA environment and the requested BackingStoreFactory
implementation is not
available.public boolean isHaEnvironmentConfigured()
true
in case there is a HA service available in the current
JVM, false
otherwisepublic <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)
BackingStore
instance.
The original checked BackingStoreException
is wrapped into a new
unchecked HighAvailabilityProviderException
.K
- backing store key parameter typeV
- backing store value parameter typefactory
- BackingStoreFactory
instancebackingStoreName
- name of the backing store to be createdkeyClass
- backing store key classvalueClass
- backing store value classBackingStore
instance.public static <K extends Serializable,V extends Serializable> V loadFrom(org.glassfish.ha.store.api.BackingStore<K,V> backingStore, K key, String version)
BackingStore
instance.
The original checked BackingStoreException
is wrapped into a new
unchecked HighAvailabilityProviderException
.K
- backing store key parameter typeV
- backing store data parameter typebackingStore
- BackingStore
instancekey
- stored data identifierversion
- stored data versionBackingStore.load(java.io.Serializable, String)
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)
BackingStore
instance.
The original checked BackingStoreException
is wrapped into a new
unchecked HighAvailabilityProviderException
.K
- backing store key parameter typeV
- backing store value parameter typebackingStore
- BackingStore
instancekey
- stored data identifiervalue
- data to be storedisNew
- See BackingStore.save(java.io.Serializable, java.io.Serializable, boolean)
BackingStore.save(java.io.Serializable, java.io.Serializable, boolean)
public static <K extends Serializable,V extends Serializable> void removeFrom(org.glassfish.ha.store.api.BackingStore<K,V> backingStore, K key)
BackingStore
instance.
The original checked BackingStoreException
is wrapped into a new
unchecked HighAvailabilityProviderException
.K
- backing store key parameter typeV
- backing store data parameter typebackingStore
- BackingStore
instancekey
- stored data identifierpublic static void close(org.glassfish.ha.store.api.BackingStore<?,?> backingStore)
BackingStore
instance.
The original checked BackingStoreException
is wrapped into a new
unchecked HighAvailabilityProviderException
.backingStore
- BackingStore
instancepublic static void destroy(org.glassfish.ha.store.api.BackingStore<?,?> backingStore)
BackingStore
instance.
The original checked BackingStoreException
is wrapped into a new
unchecked HighAvailabilityProviderException
.backingStore
- BackingStore
instancepublic static <K extends Serializable> void removeExpired(org.glassfish.ha.store.api.BackingStore<K,?> backingStore)
BackingStore
instance.
The original checked BackingStoreException
is wrapped into a new
unchecked HighAvailabilityProviderException
.backingStore
- BackingStore
instanceCopyright © 2015 Oracle Corporation. All rights reserved.