Skip navigation links

Oracle® Fusion Middleware Java API Reference for Oracle Coherence
12c (12.1.3.0.0)

E47890-01


com.tangosol.net.partition
Class SimpleAssignmentStrategy.AnalysisContext

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

Enclosing class:
SimpleAssignmentStrategy

protected class SimpleAssignmentStrategy.AnalysisContext
extends java.lang.Object

AnalysisContext holds the working view of the partition ownership that is used throughout the analysis and is used to reflect changes made during this analysis.


Nested Class Summary
 class SimpleAssignmentStrategy.AnalysisContext.LoadComparator
          LoadComparator is a Comparator that can be used to compare two Member objects based on their partition load (as defined by the LoadCalculator).
 class SimpleAssignmentStrategy.AnalysisContext.NotOwnedFilter
          NotOwnedFilter is a Filter implementation used to evaluate Member objects, and selects members who are not represented in the reference ownership object.
 class SimpleAssignmentStrategy.AnalysisContext.SafetyFilter
          SafetyFilter is a Filter implementation used to evaluate Member objects, and selects members that are "strong" with respect to the reference ownership, as defined by the backup-strength.
 class SimpleAssignmentStrategy.AnalysisContext.StrengthComparator
          StrengthComparator is an Comparator that can be used to compare two Member objects based on their "distance" from a given set of members (as represented by an Ownership object).
 class SimpleAssignmentStrategy.AnalysisContext.UnderloadedFilter
          UnderloadedFilter is a Filter implementation that is used to evaluate Member objects, and selects those whose partition load is "underloaded" in comparison to the fair-share load.

 

Field Summary
protected  Ownership[] m_aOwners
          The ownership array for this analysis context.
protected  Member[] m_aOwnershipMembers
          An array of the ownership members to include in the distribution, arranged in arbitrary order.
protected  SimpleAssignmentStrategy.LoadCalculator m_calculatorBackup
          The backup LoadCalculator.
protected  SimpleAssignmentStrategy.LoadCalculator m_calculatorPrimary
          The primary LoadCalculator.
protected  int m_cBackupActual
          The number of backup storages to maintain.
protected  long m_cDelay
          An explicit delay to be used in favor of a determined delay in calculateAnalysisDelay().
protected  int m_cFairShareBackup
          The fair-share backup partition load.
protected  int m_cFairSharePrimary
          The fair-share primary partition load.
protected  long m_ldtCompleted
          The timestamp of when the analysis represented by this context was completed, or 0 if it is not yet complete.
protected  java.util.Map m_mapOwnedPartitions
          The map of member ownership information for this analysis context.
protected  PartitionSet m_partsOrphaned
          The set of partitions that were determined to be orphaned in the call to PartitionAssignmentStrategy.analyzeOrphans(Map).
protected  PartitionSet m_partsUpdated
          The set of partitions that have been updated in this analysis context; may be null.
protected  java.util.Set m_setOwnershipMembers
          The set of ownership members to include in the distribution.
protected  SimpleAssignmentStrategy.BackupStrength m_strength
          The backup strength for the resiliency of the resulting distribution.

 

Constructor Summary
SimpleAssignmentStrategy.AnalysisContext()
          Default constructor.

 

Method Summary
protected  long calculateAnalysisDelay()
          Calculate whether the analysis should be delayed.
protected  int calculateFairShare(boolean fPrimary)
          Return the "fair share" (F) load.
protected  PartitionSet collectEndangered(PartitionSet parts)
          Return a partition set representing the subset of the specified partitions that are "endangered".
protected  PartitionSet collectOrphaned(PartitionSet parts)
          Return a partition set representing the subset of the specified partitions that are "orphaned".
protected  PartitionSet collectWeak(PartitionSet parts)
          Return a partition set representing the subset of the specified partitions that are "weak" or "vulnerable" (as defined by the backup strength).
protected  void copyTransients(SimpleAssignmentStrategy.AnalysisContext ctxLast)
          Copy transient values from another, generally the previous, AnalysisContext to this AnalysisContext.
protected  PartitionSet ensureUpdatedPartitions()
          Ensure and return the set of updated partitions.
protected  int getActualBackupCount()
          Return the number of backups to maintain, given the actual set of ownership-enabled and leaving members.
protected  long getAnalysisDelay()
          Return the number of milliseconds the analysis should be delayed; 0L suggests immediate analysis.
 SimpleAssignmentStrategy.LoadCalculator getBackupLoadCalculator()
          Return the LoadCalculator used to calculate the backup partition load.
protected  SimpleAssignmentStrategy.BackupStrength getBackupStrength()
          Return the BackupStrength for this analysis context.
 long getCompletedTime()
          Return the time at which the analysis associated with this context was completed, or 0 if it has not been completed.
protected  int getFairShare(boolean fPrimary)
          Return the (primary or backup) fair-share partition load.
protected  int getMemberLoad(Member member, boolean fPrimary)
          Return the (primary or backup) partition load of the specified member.
protected  PartitionSet getOrphanedPartitions()
          Return the partitions deemed orphaned as a result of a previous execution of analyzeOrphans.
 PartitionSet getOwnedPartitions(Member member, int iStore)
          Return the set of partitions for which the specified member owns (or has been assigned by this analysis to own) the specified storage index.
protected  java.util.Set getOwnershipMembers()
          Return the set of members across which to distribute the partition ownership.
protected  Member[] getOwnershipMembersList()
          Return an array containing the members across which to distribute the partition ownership, arranged in arbitrary order.
protected  int getPartitionLoad(int iPartition, boolean fPrimary)
          Return the load (as defined by the appropriate load calculator) for the specified partition.
 Ownership getPartitionOwnership(int iPartition)
          Return the Ownership information (or the ownership assigned by this analysis) for the specified partition.
 SimpleAssignmentStrategy.LoadCalculator getPrimaryLoadCalculator()
          Return the LoadCalculator used to calculate the primary partition load.
protected  PartitionSet getUpdatedPartitions()
          Return the set of updated partitions; may be null.
protected  void initialize()
          Initialize the AnalysisContext.
protected  SimpleAssignmentStrategy.BackupStrength instantiateBackupStrength(java.util.Set setOwners)
          Create a backup strength to be used for distribution among the specified set of ownership members.
 java.util.Comparator instantiateDefaultComparator()
          Instantiate a default member Comparator.
 SimpleAssignmentStrategy.AnalysisContext.LoadComparator instantiateLoadComparator(boolean fPrimary)
          Return a comparator for primary or backup partition load.
 Filter instantiateNotOwnedFilter(Ownership owners)
          Instantiate and return a NotOwnedFilter with the specified ownership.
 Filter instantiateOverloadedFilter(boolean fPrimary)
          Instantiate a filter that matches members with an over-load.
 Filter instantiateSafetyFilter(Ownership owners, int iStore)
          Instantiate and return a SafetyFilter with the specified ownership.
 SimpleAssignmentStrategy.AnalysisContext.StrengthComparator instantiateStrengthComparator(Ownership owners)
          Instantiate a StrengthComparator for the specified reference ownership.
 Filter instantiateUnderloadedFilter(boolean fPrimary)
          Instantiate a filter that matches members with an under-load.
protected  boolean isMemberLeaving(Member member)
          Return true iff the specified member is in the process of leaving.
protected  boolean isPartitionEndangered(int iPartition)
          Return true iff the specified partition is "endangered".
protected  boolean isPartitionEndangered(Ownership owners)
          Return true iff the specified ownership is "endangered".
protected  boolean isPartitionStrong(int iPartition)
          Return true iff the ownership of the specified partition is "strong", as defined by the current BackupStrength.
protected  boolean isPartitionStrong(Ownership owners)
          Return true iff the specified ownership is "strong", as defined by the current BackupStrength.
protected  boolean isStrong(Member member1, Member member2)
          Return true iff the specified members are mutually "strong", as defined by the backup strength.
protected  boolean isStrong(Member member, Ownership owners)
          Return true iff the specified member is "strong" with respect to the specified ownership, as defined by the backup strength.
protected  boolean isStrongPossible(java.util.Set setOwners, java.util.Map mapSplit)
          Return true iff a "strong" balanced distribution is achievable for the specified set of members, split among a set of categories (e.g. machine, rack, site).
protected  boolean isTransferStrong(int iPartition, int iStore, Member member)
          Return true iff the specified partition transfer would result in a "strong" ownership, as defined by the current BackupStrength.
protected  void resetTransients()
          Reset those attributes that should be transient between SimpleAssignmentStrategy.analyzeDistribution() requests.
protected  void setAnalysisDelay(long cDelay)
          Set the number of milliseconds the analysis should be delayed; 0L suggests immediate analysis.
protected  void setBackupStrength(SimpleAssignmentStrategy.BackupStrength strength)
          Set the BackupStrength for this analysis context.
protected  void setCompletedTime(long ldt)
          Set the timestamp at which the analysis associated with this context completed.
protected  void setOrphanedPartitions(PartitionSet parts)
          Set the orphaned partitions that can be prioritized for transfer in order to reduce the transfer cost.
protected  boolean suggestDistribution()
          Suggest any distribution that may have been collected by this analysis context to the DistributionManager.
protected  void transitionPartition(int iPartition, int iStore, Member memberFrom, Member memberTo)
          Update the analysis context to reflect the suggested transfer of the specified number of primary partitions between the specified members.

 

Field Detail

m_calculatorPrimary

protected SimpleAssignmentStrategy.LoadCalculator m_calculatorPrimary
The primary LoadCalculator.

m_calculatorBackup

protected SimpleAssignmentStrategy.LoadCalculator m_calculatorBackup
The backup LoadCalculator.

m_mapOwnedPartitions

protected java.util.Map m_mapOwnedPartitions
The map of member ownership information for this analysis context.

m_aOwners

protected Ownership[] m_aOwners
The ownership array for this analysis context.

m_partsUpdated

protected PartitionSet m_partsUpdated
The set of partitions that have been updated in this analysis context; may be null.

m_partsOrphaned

protected PartitionSet m_partsOrphaned
The set of partitions that were determined to be orphaned in the call to PartitionAssignmentStrategy.analyzeOrphans(Map).

m_strength

protected SimpleAssignmentStrategy.BackupStrength m_strength
The backup strength for the resiliency of the resulting distribution.

m_cBackupActual

protected int m_cBackupActual
The number of backup storages to maintain.

Note: this may differ from the configured backup count if there is an inadequate number of ownership members to sustain the configured backup count.


m_cFairSharePrimary

protected int m_cFairSharePrimary
The fair-share primary partition load.

m_cFairShareBackup

protected int m_cFairShareBackup
The fair-share backup partition load.

m_setOwnershipMembers

protected java.util.Set m_setOwnershipMembers
The set of ownership members to include in the distribution.

Note: this set does not include members that are leaving


m_aOwnershipMembers

protected Member[] m_aOwnershipMembers
An array of the ownership members to include in the distribution, arranged in arbitrary order. This array could be used for algorithms performing in-place sorting of the members.

Note: this list does not include members that are leaving


m_ldtCompleted

protected long m_ldtCompleted
The timestamp of when the analysis represented by this context was completed, or 0 if it is not yet complete.

m_cDelay

protected long m_cDelay
An explicit delay to be used in favor of a determined delay in calculateAnalysisDelay().

Constructor Detail

SimpleAssignmentStrategy.AnalysisContext

public SimpleAssignmentStrategy.AnalysisContext()
Default constructor.

Method Detail

getUpdatedPartitions

protected PartitionSet getUpdatedPartitions()
Return the set of updated partitions; may be null.
Returns:
the set of updated partitions, or null

getBackupStrength

protected SimpleAssignmentStrategy.BackupStrength getBackupStrength()
Return the BackupStrength for this analysis context. The backup strength determines the degree of resiliency that the resulting distribution will ensure (e.g. machine-safe, rack-safe, site-safe).
Returns:
the backup strength

setBackupStrength

protected void setBackupStrength(SimpleAssignmentStrategy.BackupStrength strength)
Set the BackupStrength for this analysis context.
Parameters:
strength - the backup strength

getOwnershipMembers

protected java.util.Set getOwnershipMembers()
Return the set of members across which to distribute the partition ownership.

Note: The set of ownership members does not include any members that may be in the process of leaving

Returns:
the set of (non-leaving) ownership enabled members

getOwnershipMembersList

protected Member[] getOwnershipMembersList()
Return an array containing the members across which to distribute the partition ownership, arranged in arbitrary order.

Note: The array does not include any members that may be in the process of leaving

Returns:
an array containing the (non-leaving) ownership enabled members

getPrimaryLoadCalculator

public SimpleAssignmentStrategy.LoadCalculator getPrimaryLoadCalculator()
Return the LoadCalculator used to calculate the primary partition load.
Returns:
the primary partition load calculator

getBackupLoadCalculator

public SimpleAssignmentStrategy.LoadCalculator getBackupLoadCalculator()
Return the LoadCalculator used to calculate the backup partition load.
Returns:
the backup partition load calculator

getActualBackupCount

protected int getActualBackupCount()
Return the number of backups to maintain, given the actual set of ownership-enabled and leaving members.
Returns:
the number of backups to maintain

getCompletedTime

public long getCompletedTime()
Return the time at which the analysis associated with this context was completed, or 0 if it has not been completed.
Returns:
the time at which the analysis was completed, or 0

setCompletedTime

protected void setCompletedTime(long ldt)
Set the timestamp at which the analysis associated with this context completed.
Parameters:
ldt - the completion timestamp, or 0

getOrphanedPartitions

protected PartitionSet getOrphanedPartitions()
Return the partitions deemed orphaned as a result of a previous execution of analyzeOrphans.
Returns:
the partitions deemed orphaned after executing analyzeOrphans

setOrphanedPartitions

protected void setOrphanedPartitions(PartitionSet parts)
Set the orphaned partitions that can be prioritized for transfer in order to reduce the transfer cost.
Parameters:
parts - the set of orphaned partitions

getAnalysisDelay

protected long getAnalysisDelay()
Return the number of milliseconds the analysis should be delayed; 0L suggests immediate analysis.
Returns:
the number of milliseconds the analysis should be delayed

setAnalysisDelay

protected void setAnalysisDelay(long cDelay)
Set the number of milliseconds the analysis should be delayed; 0L suggests immediate analysis.
Parameters:
cDelay - the number of milliseconds the analysis should be delayed

resetTransients

protected void resetTransients()
Reset those attributes that should be transient between SimpleAssignmentStrategy.analyzeDistribution() requests.

initialize

protected void initialize()
Initialize the AnalysisContext.

copyTransients

protected void copyTransients(SimpleAssignmentStrategy.AnalysisContext ctxLast)
Copy transient values from another, generally the previous, AnalysisContext to this AnalysisContext. This provides an opportunity for the other context to impart knowledge to this context.
Parameters:
ctxLast - the previous AnalysisContext

getFairShare

protected int getFairShare(boolean fPrimary)
Return the (primary or backup) fair-share partition load.
Parameters:
fPrimary - true iff the primary fair-share should be returned
Returns:
the fair-share partition load

calculateFairShare

protected int calculateFairShare(boolean fPrimary)
Return the "fair share" (F) load. It is a ceiling for the load on a for fully balance distribution. The fairness goal is to achieve such a state that the load for all members is between F-L and F, where L is typically the minimum of partition load values.
Parameters:
fPrimary - true for the primary fair-share, or false for backup
Returns:
the fair share

isMemberLeaving

protected boolean isMemberLeaving(Member member)
Return true iff the specified member is in the process of leaving.
Parameters:
member - the member
Returns:
true iff the specified member is in the process of leaving

instantiateBackupStrength

protected SimpleAssignmentStrategy.BackupStrength instantiateBackupStrength(java.util.Set setOwners)
Create a backup strength to be used for distribution among the specified set of ownership members.
Parameters:
setOwners - the ownership members
Returns:
the backup strength

isStrongPossible

protected boolean isStrongPossible(java.util.Set setOwners,
                                   java.util.Map mapSplit)
Return true iff a "strong" balanced distribution is achievable for the specified set of members, split among a set of categories (e.g. machine, rack, site).
Parameters:
setOwners - the set of ownership members
mapSplit - the map of members, associated by their category
Returns:
true iff a "strong" balanced distribution is achievable

isPartitionStrong

protected boolean isPartitionStrong(int iPartition)
Return true iff the ownership of the specified partition is "strong", as defined by the current BackupStrength.
Parameters:
iPartition - the partition
Returns:
true iff the specified partition is strong

isPartitionStrong

protected boolean isPartitionStrong(Ownership owners)
Return true iff the specified ownership is "strong", as defined by the current BackupStrength.
Parameters:
owners - the ownership
Returns:
true iff the specified ownership is strong

isTransferStrong

protected boolean isTransferStrong(int iPartition,
                                   int iStore,
                                   Member member)
Return true iff the specified partition transfer would result in a "strong" ownership, as defined by the current BackupStrength.
Parameters:
iPartition - the partition to transfer
iStore - the storage index to transfer
member - the member receiving the transfer
Returns:
true iff the specified partition transfer is strong

isStrong

protected boolean isStrong(Member member1,
                           Member member2)
Return true iff the specified members are mutually "strong", as defined by the backup strength.
Parameters:
member1 - the first member to compare
member2 - the second member to compare
Returns:
true iff the specified members are mutually strong

isStrong

protected boolean isStrong(Member member,
                           Ownership owners)
Return true iff the specified member is "strong" with respect to the specified ownership, as defined by the backup strength.
Parameters:
member - the member
owners - the ownership
Returns:
true iff the member is "strong" with respect to the ownership

collectOrphaned

protected PartitionSet collectOrphaned(PartitionSet parts)
Return a partition set representing the subset of the specified partitions that are "orphaned".
Parameters:
parts - the partition set to collect
Returns:
a partition set containing the orphaned partitions

collectWeak

protected PartitionSet collectWeak(PartitionSet parts)
Return a partition set representing the subset of the specified partitions that are "weak" or "vulnerable" (as defined by the backup strength).
Parameters:
parts - the partition set to collect
Returns:
a partition set containing the weak partitions

isPartitionEndangered

protected boolean isPartitionEndangered(int iPartition)
Return true iff the specified partition is "endangered". A partition is "endangered" if it is incompletely backed up (e.g. some backup copies do not exist).
Parameters:
iPartition - the partition to test the endangered status
Returns:
true iff the specified partition is endangered

isPartitionEndangered

protected boolean isPartitionEndangered(Ownership owners)
Return true iff the specified ownership is "endangered". A partition is "endangered" if it is incompletely backed up (e.g. some backup copies do not exist).
Parameters:
owners - the ownership to test for endangered status
Returns:
true iff the specified partition is endangered

collectEndangered

protected PartitionSet collectEndangered(PartitionSet parts)
Return a partition set representing the subset of the specified partitions that are "endangered".
Parameters:
parts - the partition set to collect
Returns:
a partition set containing the endangered partitions

ensureUpdatedPartitions

protected PartitionSet ensureUpdatedPartitions()
Ensure and return the set of updated partitions.
Returns:
the set of updated partitions

getOwnedPartitions

public PartitionSet getOwnedPartitions(Member member,
                                       int iStore)
Return the set of partitions for which the specified member owns (or has been assigned by this analysis to own) the specified storage index.
Parameters:
member - the member
iStore - the storage index
Returns:
the set of partitions owned by the member at the specified index

getPartitionOwnership

public Ownership getPartitionOwnership(int iPartition)
Return the Ownership information (or the ownership assigned by this analysis) for the specified partition.
Parameters:
iPartition - the partition to return the ownership for
Returns:
the Ownership information

getPartitionLoad

protected int getPartitionLoad(int iPartition,
                               boolean fPrimary)
Return the load (as defined by the appropriate load calculator) for the specified partition.
Parameters:
iPartition - the partition to determine the load of
fPrimary - true iff the primary load should be returned, or false for backup
Returns:
the load for the specified partition

getMemberLoad

protected int getMemberLoad(Member member,
                            boolean fPrimary)
Return the (primary or backup) partition load of the specified member.
Parameters:
member - the member to calculate the partition load for
fPrimary - true for primary partition load, else backup load
Returns:
the partition load for the specified member

calculateAnalysisDelay

protected long calculateAnalysisDelay()
Calculate whether the analysis should be delayed.
Returns:
the delay before the next analysis, or 0 if the analysis should commence immediately

transitionPartition

protected void transitionPartition(int iPartition,
                                   int iStore,
                                   Member memberFrom,
                                   Member memberTo)
Update the analysis context to reflect the suggested transfer of the specified number of primary partitions between the specified members.
Parameters:
iPartition - the partition id to transfer
iStore - the storage index to transfer
memberFrom - the member to transfer partitions from, or null if the partition storage-index was endangered
memberTo - the member to transfer partitions to, or null if the partition storage index should be endangered

suggestDistribution

protected boolean suggestDistribution()
Suggest any distribution that may have been collected by this analysis context to the DistributionManager.
Returns:
true iff a distribution was suggested

instantiateNotOwnedFilter

public Filter instantiateNotOwnedFilter(Ownership owners)
Instantiate and return a NotOwnedFilter with the specified ownership.
Parameters:
owners - the ownership
Returns:
a NotOwnedFilter

instantiateSafetyFilter

public Filter instantiateSafetyFilter(Ownership owners,
                                      int iStore)
Instantiate and return a SafetyFilter with the specified ownership.
Parameters:
owners - the ownership
iStore - the storage index at which to evaluate members for safety
Returns:
a SafetyFilter

instantiateOverloadedFilter

public Filter instantiateOverloadedFilter(boolean fPrimary)
Instantiate a filter that matches members with an over-load.
Parameters:
fPrimary - true for primary partition load
Returns:
a filter that matches members with an over-load

instantiateUnderloadedFilter

public Filter instantiateUnderloadedFilter(boolean fPrimary)
Instantiate a filter that matches members with an under-load.
Parameters:
fPrimary - true for primary partition load
Returns:
a filter that matches members with an under-load

instantiateLoadComparator

public SimpleAssignmentStrategy.AnalysisContext.LoadComparator instantiateLoadComparator(boolean fPrimary)
Return a comparator for primary or backup partition load.
Parameters:
fPrimary - true for primary, or false for backup
Returns:
a comparator for primary or backup partition load

instantiateStrengthComparator

public SimpleAssignmentStrategy.AnalysisContext.StrengthComparator instantiateStrengthComparator(Ownership owners)
Instantiate a StrengthComparator for the specified reference ownership.
Parameters:
owners - the ownership, from which to determine member strength
Returns:
a StrengthComparator

instantiateDefaultComparator

public java.util.Comparator instantiateDefaultComparator()
Instantiate a default member Comparator. The returned comparator must define a strict total ordering over the set of Members. In other words, no two distinct members may be compared to be equivalent.
Returns:
a Comparator that defines a strict total ordering of Members

Skip navigation links

Oracle® Fusion Middleware Java API Reference for Oracle Coherence
12c (12.1.3.0.0)

E47890-01


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