Skip navigation links

Oracle® Coherence Java API Reference
Release 12.1.2.0.3

E26043-02


com.tangosol.net.partition
Class MirroringAssignmentStrategy

java.lang.Object
  extended by com.tangosol.net.partition.SimpleAssignmentStrategy
      extended by com.tangosol.net.partition.MirroringAssignmentStrategy

All Implemented Interfaces:
PartitionAssignmentStrategy, SimpleStrategyMBean

public class MirroringAssignmentStrategy
extends SimpleAssignmentStrategy

A PartitionAssignmentStrategy used by a service to attempt to co-locate the primary ownership of partitions on the same members as another service. This strategy does not guarantee that partitions will be co-located, but will make a best-effort attempt.

Since:
Coherence 3.7.1
Author:
rhl 2011.06.29

Nested Class Summary

 

Nested classes/interfaces inherited from class com.tangosol.net.partition.SimpleAssignmentStrategy
SimpleAssignmentStrategy.AnalysisContext, SimpleAssignmentStrategy.BackupStrength, SimpleAssignmentStrategy.LoadCalculator, SimpleAssignmentStrategy.SimpleLoadCalculator

 

Field Summary
protected  PartitionedService m_service
          The associated service that this strategy attempts to co-locate partitions with.
protected  java.lang.String m_sService
          The name of the associated service.

 

Fields inherited from class com.tangosol.net.partition.SimpleAssignmentStrategy
m_ctxLast, m_emitter, m_manager, m_mapSuggestLast, m_setOwnersLast, MEMBERID_COMPARATOR, MSG_NO_PENDING, MSG_NO_RESULT, NOTIFY_LOST

 

Constructor Summary
MirroringAssignmentStrategy(java.lang.String sService)
          Construct a MirroringAssignmentStrategy to be associated the specified service.

 

Method Summary
protected  long analyzeDistribution(SimpleAssignmentStrategy.AnalysisContext ctx)
          Analyze the distribution using the specified analysis context.
protected  PartitionedService bindService(java.lang.String sService)
          Bind this assignment strategy to the specified partitioned service, and return the bound service.
 PartitionedService getAssociatedService()
          Return the associated service.
 java.lang.String getDescription()
          Return a human-readable description of the state of the partition assignment.
 PartitionedService getService()
          Return the partitioned service for which this assignment strategy controls the distribution.
 void init(DistributionManager manager)
          Initialize the PartitionAssignmentStrategy and bind it to the specified DistributionManager.
protected  boolean isRefinementNeeded(SimpleAssignmentStrategy.AnalysisContext ctx, PartitionedService serviceThis, PartitionedService serviceThat)
          Return true iff the partition assignments sync'd from the specified associated service should be further refined/balanced by the local assignment strategy.
protected  void setAssociatedService(PartitionedService service)
          Set the associated service.
protected  void syncAssignments(SimpleAssignmentStrategy.AnalysisContext ctx, PartitionedService serviceThat)
          Update the analysis context to reflect the partition assignments of the specified associated service.
protected  boolean validateAssociatedService(PartitionedService service)
          Validate that the distribution for the specified service is compatible with this service.

 

Methods inherited from class com.tangosol.net.partition.SimpleAssignmentStrategy
analyzeDistribution, analyzeOrphans, chainComparators, chainComparators, checkBackupBalance, checkBackupStrong, checkEndangered, checkLeaving, checkPrimaryBalance, collectPendingDistributions, doBalancePrimary, emitLossNotification, filterArray, filterArray, filterSort, filterSort, getBackupCount, getCoordinatorId, getFairShareBackup, getFairSharePrimary, getHAStatus, getHATarget, getLastAnalysisContext, getLastAnalysisTime, getLastOwnershipMembers, getManager, getMember, getMemberJoinDelay, getPartitionCount, getRemainingDistributionCount, getServiceMachineCount, getServiceNodeCount, getServiceRackCount, getServiceSiteCount, getStrategyName, getSuggestionCompletionDelay, getUnownedPartitions, getVariance, instantiateAnalysisContext, instantiateLoadCalculator, makeMBeanName, registerMBean, reportPendingDistributions, setLastAnalysisContext, setLastOwnershipMembers, splitByOwner, toString, unregisterMBean, validateBackups

 

Field Detail

m_service

protected PartitionedService m_service
The associated service that this strategy attempts to co-locate partitions with. May be null.

m_sService

protected java.lang.String m_sService
The name of the associated service.

Constructor Detail

MirroringAssignmentStrategy

public MirroringAssignmentStrategy(java.lang.String sService)
Construct a MirroringAssignmentStrategy to be associated the specified service.
Parameters:
sService - the name of the associated service

Method Detail

getService

public PartitionedService getService()
Return the partitioned service for which this assignment strategy controls the distribution.
Returns:
the partitioned service controlled by this assignment strategy

setAssociatedService

protected void setAssociatedService(PartitionedService service)
Set the associated service.
Parameters:
service - the associated service

getAssociatedService

public PartitionedService getAssociatedService()
Return the associated service.
Returns:
the associated service

validateAssociatedService

protected boolean validateAssociatedService(PartitionedService service)
Validate that the distribution for the specified service is compatible with this service.
Parameters:
service - the service to validate
Returns:
true iff the specified service is compatible

syncAssignments

protected void syncAssignments(SimpleAssignmentStrategy.AnalysisContext ctx,
                               PartitionedService serviceThat)
Update the analysis context to reflect the partition assignments of the specified associated service.
Parameters:
ctx - the analysis context
serviceThat - the associated service whose partition assignments to sync

bindService

protected PartitionedService bindService(java.lang.String sService)
Bind this assignment strategy to the specified partitioned service, and return the bound service.
Parameters:
sService - the name of the service to bind
Returns:
the partitioned service

isRefinementNeeded

protected boolean isRefinementNeeded(SimpleAssignmentStrategy.AnalysisContext ctx,
                                     PartitionedService serviceThis,
                                     PartitionedService serviceThat)
Return true iff the partition assignments sync'd from the specified associated service should be further refined/balanced by the local assignment strategy.
Parameters:
ctx - the analysis context
serviceThis - the local service
serviceThat - the associated service (may be null if unbound)
Returns:
true iff the partition assignments should be further refined

init

public void init(DistributionManager manager)
Initialize the PartitionAssignmentStrategy and bind it to the specified DistributionManager. This method is called only on the distribution coordinator, prior its first distribution analysis.
Specified by:
init in interface PartitionAssignmentStrategy
Overrides:
init in class SimpleAssignmentStrategy
Parameters:
manager - the DistributionManager that this strategy is bound to

getDescription

public java.lang.String getDescription()
Return a human-readable description of the state of the partition assignment.
Specified by:
getDescription in interface PartitionAssignmentStrategy
Overrides:
getDescription in class SimpleAssignmentStrategy
Returns:
a human-readable description

analyzeDistribution

protected long analyzeDistribution(SimpleAssignmentStrategy.AnalysisContext ctx)
Analyze the distribution using the specified analysis context.
Overrides:
analyzeDistribution in class SimpleAssignmentStrategy
Parameters:
ctx - the analysis context
Returns:
the time interval before the next desired analysis, or -1
See Also:
SimpleAssignmentStrategy.analyzeDistribution()

Skip navigation links

Oracle® Coherence Java API Reference
Release 12.1.2.0.3

E26043-02


Copyright © 2000, 2014, Oracle and/or its affiliates. All rights reserved.