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.
|
<K,V> DistributedMap<K,V> |
getMap(Namespace namespace,
boolean useCacheSerializer)
Gets a distributed map by possibility to specify to use cache
serializer.
|
DistributedPredicate |
getPredicate()
Creates a distributed Predicate.
|
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
- configurationpublic DistributedPredicate getPredicate()
CoordinationService
getPredicate
in interface CoordinationService
public <K,V> DistributedMap<K,V> getMap(Namespace namespace, boolean useCacheSerializer)
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 namespaceuseCacheSerializer
- specifies that calls to register
serializer/deserializer will be done by cache itself or by
coordination service. True value indicates that calls will be
done by cache. This option also enables to do query on returned
DistributedMap. False value indicates that calls will be done by
coordination service.Copyright © 2016. All Rights Reserved.