public class HazelcastCoordinationService extends Object implements CoordinationService
coordination service
using
Hazelcast as the underlying technology.Modifier and Type | Method and Description |
---|---|
void |
configureMap(Namespace namespace,
MapConfiguration configuration)
Sets a particular configuration for a distributed map.
|
static Restrictable<CoordinationService,RestrictedCoordinationService> |
create(HazelcastConfiguration configuration,
org.slf4j.Logger logger)
Creates a
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,RestrictedCoordinationService> create(HazelcastConfiguration configuration, org.slf4j.Logger logger)
CoordinationService
configuration
- configurationlogger
- loggerpublic <T> void registerSerializer(Serializer<T> serializer, Class<T> subject) throws UnsupportedOperationException
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 toUnsupportedOperationException
- if this operation is not
supported by the implementationpublic <T> void unregisterSerializer(Class<T> subject) throws UnsupportedOperationException
CoordinationService
CoordinationService.registerSerializer(Serializer, Class)
.unregisterSerializer
in interface CoordinationService
subject
- subject the serializer is associated toUnsupportedOperationException
- if this operation is not
supported by the implementationpublic 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) throws UnsupportedOperationException
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
- configurationUnsupportedOperationException
- if this operation is not
supported by the implementationCopyright © 2015. All Rights Reserved.