com.hazelcast.map.impl
Class MapService

java.lang.Object
  extended by com.hazelcast.map.impl.MapService
All Implemented Interfaces:
ClientAwareService, EventPublishingService<EventData,ListenerAdapter>, ManagedService, MigrationAwareService, PartitionAwareService, PostJoinAwareService, QuorumAwareService, RemoteService, ReplicationSupportingService, SplitBrainHandlerService, StatisticsAwareService, TransactionalService

public class MapService
extends Object
implements ManagedService, MigrationAwareService, TransactionalService, RemoteService, EventPublishingService<EventData,ListenerAdapter>, PostJoinAwareService, SplitBrainHandlerService, ReplicationSupportingService, StatisticsAwareService, PartitionAwareService, ClientAwareService, QuorumAwareService

Defines map service behavior.

See Also:
MapManagedService, MapMigrationAwareService, MapTransactionalService, MapRemoteService, MapEventPublishingService, MapPostJoinAwareService, MapSplitBrainHandlerService, MapReplicationSupportingService, MapStatisticsAwareService, MapPartitionAwareService, MapQuorumAwareService, MapClientAwareService, MapServiceContext

Field Summary
protected  ClientAwareService clientAwareService
           
protected  EventPublishingService eventPublishingService
           
protected  ManagedService managedService
           
protected  MapServiceContext mapServiceContext
           
protected  MigrationAwareService migrationAwareService
           
protected  PartitionAwareService partitionAwareService
           
protected  PostJoinAwareService postJoinAwareService
           
protected  QuorumAwareService quorumAwareService
           
protected  RemoteService remoteService
           
protected  ReplicationSupportingService replicationSupportingService
           
static String SERVICE_NAME
          Service name of map service used to register ServiceManager.registerService(java.lang.String, java.lang.Object)
protected  SplitBrainHandlerService splitBrainHandlerService
           
protected  StatisticsAwareService statisticsAwareService
           
protected  TransactionalService transactionalService
           
 
Constructor Summary
MapService()
           
 
Method Summary
 void beforeMigration(PartitionMigrationEvent event)
           
 void clearPartitionReplica(int partitionId)
           
 void clientDisconnected(String clientUuid)
          Invoked when a client disconnects from a member.
 void commitMigration(PartitionMigrationEvent event)
           
 DistributedObject createDistributedObject(String objectName)
          Creates a distributed object.
<T extends TransactionalObject>
T
createTransactionalObject(String name, TransactionSupport transaction)
           
 void destroyDistributedObject(String objectName)
          Destroys a distributed object.
 void dispatchEvent(EventData event, ListenerAdapter listener)
           
 MapServiceContext getMapServiceContext()
           
 Operation getPostJoinOperation()
          Post join operations must be lock free, meaning no locks at all: no partition locks, no key-based locks, no service level locks, no database interaction!
 String getQuorumName(String name)
           
 Map<String,LocalMapStats> getStats()
           
 void init(NodeEngine nodeEngine, Properties properties)
          Initializes this ManagedService
 void onPartitionLost(InternalPartitionLostEvent partitionLostEvent)
          Invoked when a partition lost is detected
 void onReplicationEvent(WanReplicationEvent replicationEvent)
           
 Runnable prepareMergeRunnable()
          When the 2 separate clusters merge (resolve a split brain), this method is called to return a Runnable that will merge the clusters.
 Operation prepareReplicationOperation(PartitionReplicationEvent event)
           
 void reset()
          reset this ManagedService back to initial state.
 void rollbackMigration(PartitionMigrationEvent event)
           
 void rollbackTransaction(String transactionId)
           
 void shutdown(boolean terminate)
          Shuts down this ManagedService.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SERVICE_NAME

public static final String SERVICE_NAME
Service name of map service used to register ServiceManager.registerService(java.lang.String, java.lang.Object)

See Also:
Constant Field Values

managedService

protected ManagedService managedService

migrationAwareService

protected MigrationAwareService migrationAwareService

transactionalService

protected TransactionalService transactionalService

remoteService

protected RemoteService remoteService

eventPublishingService

protected EventPublishingService eventPublishingService

postJoinAwareService

protected PostJoinAwareService postJoinAwareService

splitBrainHandlerService

protected SplitBrainHandlerService splitBrainHandlerService

replicationSupportingService

protected ReplicationSupportingService replicationSupportingService

statisticsAwareService

protected StatisticsAwareService statisticsAwareService

partitionAwareService

protected PartitionAwareService partitionAwareService

clientAwareService

protected ClientAwareService clientAwareService

quorumAwareService

protected QuorumAwareService quorumAwareService

mapServiceContext

protected MapServiceContext mapServiceContext
Constructor Detail

MapService

public MapService()
Method Detail

dispatchEvent

public void dispatchEvent(EventData event,
                          ListenerAdapter listener)
Specified by:
dispatchEvent in interface EventPublishingService<EventData,ListenerAdapter>

init

public void init(NodeEngine nodeEngine,
                 Properties properties)
Description copied from interface: ManagedService
Initializes this ManagedService

Specified by:
init in interface ManagedService
Parameters:
nodeEngine - the NodeEngine that this ManagedService belongs to.
properties - the Properties. Can be used to pass settings to the service.

reset

public void reset()
Description copied from interface: ManagedService
reset this ManagedService back to initial state. todo: what is the purpose of reset

Specified by:
reset in interface ManagedService

shutdown

public void shutdown(boolean terminate)
Description copied from interface: ManagedService
Shuts down this ManagedService. todo: what is the purpose of the terminate variable.

Specified by:
shutdown in interface ManagedService
Parameters:
terminate - true to shut down the ManagedService

prepareReplicationOperation

public Operation prepareReplicationOperation(PartitionReplicationEvent event)
Specified by:
prepareReplicationOperation in interface MigrationAwareService

beforeMigration

public void beforeMigration(PartitionMigrationEvent event)
Specified by:
beforeMigration in interface MigrationAwareService

commitMigration

public void commitMigration(PartitionMigrationEvent event)
Specified by:
commitMigration in interface MigrationAwareService

rollbackMigration

public void rollbackMigration(PartitionMigrationEvent event)
Specified by:
rollbackMigration in interface MigrationAwareService

clearPartitionReplica

public void clearPartitionReplica(int partitionId)
Specified by:
clearPartitionReplica in interface MigrationAwareService

getPostJoinOperation

public Operation getPostJoinOperation()
Description copied from interface: PostJoinAwareService
Post join operations must be lock free, meaning no locks at all: no partition locks, no key-based locks, no service level locks, no database interaction!

Post join operations should return response, at least a null response.

Specified by:
getPostJoinOperation in interface PostJoinAwareService
Returns:
a response from the post join operation. Can be null.

createDistributedObject

public DistributedObject createDistributedObject(String objectName)
Description copied from interface: RemoteService
Creates a distributed object.

Specified by:
createDistributedObject in interface RemoteService
Parameters:
objectName - the name for the created distributed object
Returns:
the created distributed object

destroyDistributedObject

public void destroyDistributedObject(String objectName)
Description copied from interface: RemoteService
Destroys a distributed object.

Specified by:
destroyDistributedObject in interface RemoteService
Parameters:
objectName - the name of the distributed object to destroy

onReplicationEvent

public void onReplicationEvent(WanReplicationEvent replicationEvent)
Specified by:
onReplicationEvent in interface ReplicationSupportingService

onPartitionLost

public void onPartitionLost(InternalPartitionLostEvent partitionLostEvent)
Description copied from interface: PartitionAwareService
Invoked when a partition lost is detected

Specified by:
onPartitionLost in interface PartitionAwareService
Parameters:
partitionLostEvent - The event object that contains the partition id and the number of replicas that is lost

prepareMergeRunnable

public Runnable prepareMergeRunnable()
Description copied from interface: SplitBrainHandlerService
When the 2 separate clusters merge (resolve a split brain), this method is called to return a Runnable that will merge the clusters.

Specified by:
prepareMergeRunnable in interface SplitBrainHandlerService
Returns:
a Runnable that will merge the clusters

createTransactionalObject

public <T extends TransactionalObject> T createTransactionalObject(String name,
                                                                   TransactionSupport transaction)
Specified by:
createTransactionalObject in interface TransactionalService

rollbackTransaction

public void rollbackTransaction(String transactionId)
Specified by:
rollbackTransaction in interface TransactionalService

getStats

public Map<String,LocalMapStats> getStats()
Specified by:
getStats in interface StatisticsAwareService

getQuorumName

public String getQuorumName(String name)
Specified by:
getQuorumName in interface QuorumAwareService

getMapServiceContext

public MapServiceContext getMapServiceContext()

clientDisconnected

public void clientDisconnected(String clientUuid)
Description copied from interface: ClientAwareService
Invoked when a client disconnects from a member.

Specified by:
clientDisconnected in interface ClientAwareService
Parameters:
clientUuid - the Uuid of the client that disconnected from a member


Copyright © 2015 Hazelcast, Inc.. All Rights Reserved.