public interface CoordinationService
Note: Sharable objects must be Serializable
or a
Serializer
must be registered via
registerSerializer(Serializer, Class)
.
Modifier and Type | Method and Description |
---|---|
void |
configureMap(Namespace namespace,
MapConfiguration configuration)
Sets a particular configuration for a distributed map.
|
ClusterService |
getClusterService()
Gets the service to deal with the cluster.
|
DistributedLock |
getLock(Namespace namespace)
Creates a distributed lock.
|
<K,V> DistributedMap<K,V> |
getMap(Namespace namespace)
Gets a distributed map.
|
PublishSubscribeService |
getPublishSubscribeService()
Gets the service to deal with the publish-subscribe.
|
<T> void |
registerSerializer(Serializer<T> serializer,
Class<T> subject)
Registers a serializer.
|
<T> void |
unregisterSerializer(Class<T> subject)
Unregisters a previously registered serializer via
registerSerializer(Serializer, Class) . |
<T> void registerSerializer(Serializer<T> serializer, Class<T> subject)
Registering serializers allows non serializable objects to be shared.
Registering serializers may be useful if the coordination service is used in component-based applications (Like OSGi where each bundle has a class loader associated) where multiple class loaders are used, making deserialization not possible for the class loader the coordination service is associated to.
serializer
- serializersubject
- subject the serializer is associated toUnsupportedOperationException
- if this operation is not
supported by the implementation<T> void unregisterSerializer(Class<T> subject)
registerSerializer(Serializer, Class)
.subject
- subject the serializer is associated toUnsupportedOperationException
- if this operation is not
supported by the implementationClusterService getClusterService()
PublishSubscribeService getPublishSubscribeService()
DistributedLock getLock(Namespace namespace)
See LockCriticalSectionExecutor
for a higher level
synchronization abstraction.
namespace
- lock's namespace<K,V> DistributedMap<K,V> getMap(Namespace namespace)
K
- the type of keys maintained by this map. This type should be
immutable: The state of the distributed data structure is
synchronized but not the state if its elements. It is critical
this type implements equals() and hashCode() correctly.V
- the type of mapped values. This type should be immutable:
The state of the distributed data structure is synchronized but
not the state if its elements.namespace
- map's namespacevoid configureMap(Namespace namespace, MapConfiguration configuration)
A map must be configured before it is used for the first time. Changing the configuration after the map has been used is not defined and thus it depends on the implementation (It may lead to unexpected behaviors).
namespace
- map's namespaceconfiguration
- configurationUnsupportedOperationException
- if this operation is not
supported by the implementationCopyright © 2015. All Rights Reserved.