com.j_spaces.core.cluster
Class ReplicationPolicy

java.lang.Object
  extended by com.j_spaces.core.cluster.ReplicationPolicy
All Implemented Interfaces:
Serializable

public class ReplicationPolicy
extends Object
implements Serializable

See Also:
Serialized Form

Nested Class Summary
static class ReplicationPolicy.MirrorServiceConfig
          mirror service configuration
static class ReplicationPolicy.ReplicationPolicyDescription
          Replication policy description for every member.
 
Field Summary
static String ASYNC_REC_ACK_REPLICATION_MODE
           
static String ASYNC_REPLICATION_MODE
           
 String clusterName
          the name of the cluster this replication policy belongs to
 String communicationMode
           
static String DEFAULT_MIRROR_SERVICE_CONNECTOR_NAME
           
static String DEFAULT_MIRROR_SERVICE_NAME
           
static int DEFAULT_REPL_CHUNK_SIZE
           
static int DEFAULT_REPL_INTERVAL_MILLIS
           
static int DEFAULT_REPL_INTERVAL_OPERS
           
static String DEFAULT_REPL_ORIGINAL_STATE
           
static int DEFAULT_REPL_SPACE_FINDER_REPORT_INTERVAL
           
static int DEFAULT_REPL_SPACE_FINDER_TIMEOUT
           
static int DEFAULT_SYNC_ON_COMMIT_TIMEOUT
           
static int FULL_REPLICATION
           
 boolean m_IsSyncReplicationEnabled
          true if sync-replication enabled, otherwise async-repl
 String m_OwnMemberName
           
 int m_PolicyType
           
 boolean m_Recovery
           
 boolean m_ReplicateNotifyTemplates
           
 int m_ReplicationChunkSize
           
 List<String> m_ReplicationGroupMembersNames
           
 List<SpaceURL> m_ReplicationGroupMembersURLs
           
 String m_ReplicationGroupName
           
 long m_ReplicationIntervalMillis
           
 int m_ReplicationIntervalOperations
           
 String m_ReplicationMode
           
 Hashtable<String,ReplicationPolicy.ReplicationPolicyDescription> m_ReplMemberPolicyDescTable
          replication policy description table: key: memberName, value: ReplicationPolicyDescription.
 long m_SpaceFinderReportInterval
           
 long m_SpaceFinderTimeout
           
 boolean m_SyncOnCommit
           
 long m_SyncOnCommitTimeout
           
 com.j_spaces.core.cluster.sync_replication.SyncReplPolicy m_SyncReplPolicy
          group's sync-replication information, if null, not sync replication defined.
 boolean m_TriggerNotifyTemplates
           
static int MULTICAST
           
static String MULTICAST_COMMUNICATION_MODE
           
static int PARTIAL_REPLICATION
           
 String protocolAdaptorClass
          Name of Sync-Replication protocol Adaptor - by default Unicast.
static String SYNC_REC_ACK_REPLICATION_MODE
           
static String SYNC_REPLICATION_MODE
           
static int UNICAST
           
static String UNICAST_COMMUNICATION_MODE
           
 
Constructor Summary
ReplicationPolicy()
           
 
Method Summary
 String getCommunicationMode()
           
 long getMaxRedoLogCapacity()
           
 ReplicationPolicy.MirrorServiceConfig getMirrorServiceConfig()
           
 com.gigaspaces.cluster.activeelection.PrimarySpaceSelector getPrimarySpaceSelector()
           
 List<SpaceURL> getPrimaryTargets(List<String> excludeTargets)
          Returns a list of URLs or an empty list of primary targets .
 String getProtocolAdaptorClass()
          Returns protocol adaptor class of this member.
 List<SpaceURL> getRecoverableTargets(List<String> excludeTargets)
          Finds all the recovery targets in cluster.
 int getRecoveryChunkSize()
           
 int getRecoveryThreadPoolSize()
           
 int getSpaceMemberPosition(String spaceMemberName)
          This method returns the relative position of the specified space member in the replication group, or -1 if the space member is not found.
 List<SpaceURL> getSyncTargets(List<String> excludeTargets)
          Returns a list of URLs or an empty list of reliable targets to recover from.
 boolean isMirrorServiceEnabled()
           
 boolean isMulticast()
           
 boolean isOwnerMemberHasSyncReplication()
          returns true if this member has sync-replication to at least one target.
 boolean isReliableAsyncRepl()
           
 boolean isReplicateOriginalState()
           
 void setCommunicationMode(String communicationMode)
           
 void setMaxRedoLogCapacity(long capacity)
           
 void setMirrorServiceConfig(ReplicationPolicy.MirrorServiceConfig mirrorServiceConfig)
           
 void setPermittedOperations(List<ReplicationOperationType> permittedOperations)
           
 void setPrimarySpaceSelector(com.gigaspaces.cluster.activeelection.PrimarySpaceSelector primarySpaceSelector)
           
 void setProtocolAdaptorClass(String protocolAdaptorClass)
           
 void setRecoveryChunkSize(int recoveryChunkSize)
           
 void setRecoveryThreadPoolSize(int recoveryThreadPoolSize)
           
 void setReliableAsyncRepl(boolean reliableAsyncRepl)
          Sets the async-replication 'reliable' indicator; default false
 void setReplicatedOriginalState(boolean isReplOriginalState)
           
 boolean shouldReplicate(ReplicationOperationType operType)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

UNICAST_COMMUNICATION_MODE

public static final String UNICAST_COMMUNICATION_MODE
See Also:
Constant Field Values

MULTICAST_COMMUNICATION_MODE

public static final String MULTICAST_COMMUNICATION_MODE
See Also:
Constant Field Values

UNICAST

public static final int UNICAST
See Also:
Constant Field Values

MULTICAST

public static final int MULTICAST
See Also:
Constant Field Values

ASYNC_REPLICATION_MODE

public static final String ASYNC_REPLICATION_MODE
See Also:
Constant Field Values

SYNC_REPLICATION_MODE

public static final String SYNC_REPLICATION_MODE
See Also:
Constant Field Values

SYNC_REC_ACK_REPLICATION_MODE

public static final String SYNC_REC_ACK_REPLICATION_MODE
See Also:
Constant Field Values

ASYNC_REC_ACK_REPLICATION_MODE

public static final String ASYNC_REC_ACK_REPLICATION_MODE
See Also:
Constant Field Values

FULL_REPLICATION

public static final int FULL_REPLICATION
See Also:
Constant Field Values

PARTIAL_REPLICATION

public static final int PARTIAL_REPLICATION
See Also:
Constant Field Values

DEFAULT_REPL_ORIGINAL_STATE

public static final String DEFAULT_REPL_ORIGINAL_STATE
See Also:
Constant Field Values

DEFAULT_REPL_CHUNK_SIZE

public static final int DEFAULT_REPL_CHUNK_SIZE
See Also:
Constant Field Values

DEFAULT_REPL_INTERVAL_MILLIS

public static final int DEFAULT_REPL_INTERVAL_MILLIS
See Also:
Constant Field Values

DEFAULT_REPL_INTERVAL_OPERS

public static final int DEFAULT_REPL_INTERVAL_OPERS
See Also:
Constant Field Values

DEFAULT_REPL_SPACE_FINDER_TIMEOUT

public static final int DEFAULT_REPL_SPACE_FINDER_TIMEOUT
See Also:
Constant Field Values

DEFAULT_REPL_SPACE_FINDER_REPORT_INTERVAL

public static final int DEFAULT_REPL_SPACE_FINDER_REPORT_INTERVAL
See Also:
Constant Field Values

DEFAULT_SYNC_ON_COMMIT_TIMEOUT

public static final int DEFAULT_SYNC_ON_COMMIT_TIMEOUT
See Also:
Constant Field Values

m_OwnMemberName

public String m_OwnMemberName

m_ReplicationGroupName

public String m_ReplicationGroupName

m_ReplicationGroupMembersNames

public List<String> m_ReplicationGroupMembersNames

m_ReplicationGroupMembersURLs

public List<SpaceURL> m_ReplicationGroupMembersURLs

m_ReplicateNotifyTemplates

public boolean m_ReplicateNotifyTemplates

m_TriggerNotifyTemplates

public boolean m_TriggerNotifyTemplates

m_SyncOnCommit

public boolean m_SyncOnCommit

m_ReplicationMode

public String m_ReplicationMode

m_PolicyType

public int m_PolicyType

m_ReplicationChunkSize

public int m_ReplicationChunkSize

m_ReplicationIntervalMillis

public long m_ReplicationIntervalMillis

m_ReplicationIntervalOperations

public int m_ReplicationIntervalOperations

m_SpaceFinderTimeout

public long m_SpaceFinderTimeout

m_SpaceFinderReportInterval

public long m_SpaceFinderReportInterval

m_SyncOnCommitTimeout

public long m_SyncOnCommitTimeout

m_Recovery

public boolean m_Recovery

m_ReplMemberPolicyDescTable

public Hashtable<String,ReplicationPolicy.ReplicationPolicyDescription> m_ReplMemberPolicyDescTable
replication policy description table: key: memberName, value: ReplicationPolicyDescription.


m_IsSyncReplicationEnabled

public boolean m_IsSyncReplicationEnabled
true if sync-replication enabled, otherwise async-repl


m_SyncReplPolicy

public com.j_spaces.core.cluster.sync_replication.SyncReplPolicy m_SyncReplPolicy
group's sync-replication information, if null, not sync replication defined.


protocolAdaptorClass

public String protocolAdaptorClass
Name of Sync-Replication protocol Adaptor - by default Unicast.


communicationMode

public String communicationMode

clusterName

public String clusterName
the name of the cluster this replication policy belongs to


DEFAULT_MIRROR_SERVICE_NAME

public static final String DEFAULT_MIRROR_SERVICE_NAME
See Also:
Constant Field Values

DEFAULT_MIRROR_SERVICE_CONNECTOR_NAME

public static final String DEFAULT_MIRROR_SERVICE_CONNECTOR_NAME
See Also:
Constant Field Values
Constructor Detail

ReplicationPolicy

public ReplicationPolicy()
Method Detail

setMirrorServiceConfig

public void setMirrorServiceConfig(ReplicationPolicy.MirrorServiceConfig mirrorServiceConfig)

getMirrorServiceConfig

public ReplicationPolicy.MirrorServiceConfig getMirrorServiceConfig()
Returns:
null if the mirror-service disabled

isMirrorServiceEnabled

public boolean isMirrorServiceEnabled()
Returns:
if the mirror service enabled for entire replication group

isReliableAsyncRepl

public boolean isReliableAsyncRepl()
Returns:
the async-replication 'reliable' indicator; default false

shouldReplicate

public boolean shouldReplicate(ReplicationOperationType operType)

setPermittedOperations

public void setPermittedOperations(List<ReplicationOperationType> permittedOperations)

setReliableAsyncRepl

public void setReliableAsyncRepl(boolean reliableAsyncRepl)
Sets the async-replication 'reliable' indicator; default false

Parameters:
reliableAsyncRepl - true if reliable-async-replication is enabled; false otherwise.

setMaxRedoLogCapacity

public void setMaxRedoLogCapacity(long capacity)

getMaxRedoLogCapacity

public long getMaxRedoLogCapacity()

isOwnerMemberHasSyncReplication

public boolean isOwnerMemberHasSyncReplication()
returns true if this member has sync-replication to at least one target.


setPrimarySpaceSelector

public void setPrimarySpaceSelector(com.gigaspaces.cluster.activeelection.PrimarySpaceSelector primarySpaceSelector)

getPrimarySpaceSelector

public com.gigaspaces.cluster.activeelection.PrimarySpaceSelector getPrimarySpaceSelector()

getRecoverableTargets

public List<SpaceURL> getRecoverableTargets(List<String> excludeTargets)
Finds all the recovery targets in cluster. The targets are ordered according to their reliability. First all primary targets are added. Then the sync targets, and only then all the others.

Parameters:
excludeTargets - targets that should be excluded from search
Returns:
a list of recoverable members SpaceURLs. returns empty list if recovery is disabled.

getSyncTargets

public List<SpaceURL> getSyncTargets(List<String> excludeTargets)
Returns a list of URLs or an empty list of reliable targets to recover from. A 'reliable' target is one that replicates synchronously to 'this' source.

This differs from #getRecoverableTargets() in that:
1. all URLs are returned and there is no multicast URL - We need specific members.
2. The target is chosen only if it sync-replicates to 'this', in contrast to returning a target which 'this' replicates to.

Parameters:
excludeTargets -
primaryElectionAvailable - true if primary election is used; false otherwise.
Returns:
a list of URLs or an empty list of reliable targets to recover from. Never returns null.

getPrimaryTargets

public List<SpaceURL> getPrimaryTargets(List<String> excludeTargets)
Returns a list of URLs or an empty list of primary targets .

Parameters:
excludeTargets -
Returns:
a list of URLs or an empty list of primary targets. Never returns null.

isMulticast

public boolean isMulticast()

getCommunicationMode

public String getCommunicationMode()
Returns:
Returns the communicationMode.

setCommunicationMode

public void setCommunicationMode(String communicationMode)
Parameters:
communicationMode - The communicationMode to set.

getProtocolAdaptorClass

public String getProtocolAdaptorClass()
Returns protocol adaptor class of this member.


setProtocolAdaptorClass

public void setProtocolAdaptorClass(String protocolAdaptorClass)
Parameters:
protocolAdaptorClass - The protocolAdaptorClass to set.

getSpaceMemberPosition

public int getSpaceMemberPosition(String spaceMemberName)
This method returns the relative position of the specified space member in the replication group, or -1 if the space member is not found. Positions are counted from 0 to #nodes - 1. The position can be used as a unique identifier of the space within its group.


getRecoveryChunkSize

public final int getRecoveryChunkSize()

setRecoveryChunkSize

public void setRecoveryChunkSize(int recoveryChunkSize)

isReplicateOriginalState

public final boolean isReplicateOriginalState()

setReplicatedOriginalState

public void setReplicatedOriginalState(boolean isReplOriginalState)

toString

public String toString()
Overrides:
toString in class Object

getRecoveryThreadPoolSize

public int getRecoveryThreadPoolSize()

setRecoveryThreadPoolSize

public void setRecoveryThreadPoolSize(int recoveryThreadPoolSize)