public class SuspendibleCoordinationService extends Object implements CoordinationService
CoordinationService
to make it suspendible.Modifier and Type | Method and Description |
---|---|
void |
configureMap(Namespace namespace,
MapConfiguration configuration)
Sets a particular configuration for a distributed map.
|
static Restrictable<CoordinationService,SuspendibleStoppable> |
create(Restrictable<CoordinationService,Stoppable> delegate)
Create a suspendible
CoordinationService |
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
CoordinationService.registerSerializer(Serializer, Class) . |
public static Restrictable<CoordinationService,SuspendibleStoppable> create(Restrictable<CoordinationService,Stoppable> delegate)
CoordinationService
delegate
- CoordinationService
implementation to delegate
toCoordinationService
public <T> void registerSerializer(Serializer<T> serializer, Class<T> subject)
CoordinationService
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.
registerSerializer
in interface CoordinationService
serializer
- serializersubject
- subject the serializer is associated topublic <T> void unregisterSerializer(Class<T> subject)
CoordinationService
CoordinationService.registerSerializer(Serializer, Class)
.unregisterSerializer
in interface CoordinationService
subject
- subject the serializer is associated topublic ClusterService getClusterService()
CoordinationService
getClusterService
in interface CoordinationService
public PublishSubscribeService getPublishSubscribeService()
CoordinationService
getPublishSubscribeService
in interface CoordinationService
public DistributedLock getLock(Namespace namespace)
CoordinationService
See LockCriticalSectionExecutor
for a higher level
synchronization abstraction.
getLock
in interface CoordinationService
namespace
- lock's namespacepublic <K,V> DistributedMap<K,V> getMap(Namespace namespace)
CoordinationService
getMap
in interface CoordinationService
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 namespacepublic void configureMap(Namespace namespace, MapConfiguration configuration)
CoordinationService
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).
configureMap
in interface CoordinationService
namespace
- map's namespaceconfiguration
- configurationCopyright © 2015. All Rights Reserved.