Repository: ignite Updated Branches: refs/heads/ignite-1282 dfcee8d3a -> b1a3cbe30
# master - fixed javadoc for TopologyValidator. Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/7bd81c29 Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/7bd81c29 Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/7bd81c29 Branch: refs/heads/ignite-1282 Commit: 7bd81c29e3da671084c8a425fe0880b85a0644a1 Parents: 40ae364 Author: Dmitiry Setrakyan <[email protected]> Authored: Thu Sep 10 16:34:47 2015 -0700 Committer: Dmitiry Setrakyan <[email protected]> Committed: Thu Sep 10 16:34:47 2015 -0700 ---------------------------------------------------------------------- .../ignite/configuration/TopologyValidator.java | 42 ++++++++++++-------- 1 file changed, 25 insertions(+), 17 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ignite/blob/7bd81c29/modules/core/src/main/java/org/apache/ignite/configuration/TopologyValidator.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/configuration/TopologyValidator.java b/modules/core/src/main/java/org/apache/ignite/configuration/TopologyValidator.java index 874fc69..8981a57 100644 --- a/modules/core/src/main/java/org/apache/ignite/configuration/TopologyValidator.java +++ b/modules/core/src/main/java/org/apache/ignite/configuration/TopologyValidator.java @@ -17,34 +17,42 @@ package org.apache.ignite.configuration; -import java.io.Serializable; -import java.util.Collection; -import javax.cache.CacheException; -import org.apache.ignite.IgniteException; -import org.apache.ignite.cluster.ClusterNode; +import org.apache.ignite.*; +import org.apache.ignite.cluster.*; + +import javax.cache.*; +import java.io.*; +import java.util.*; /** - * Topology validator checks whether the new topology is valid for specific cache at each topology change. - * <p> - * Topology is always valid in case no topology validator used. + * Topology validator is used to verify that cluster topology is valid for further cache operations. + * The topology validator is invoked every time the cluster topology changes (either a new node joined + * or an existing node failed or left). * <p> - * In case topology is valid for specific cache all operations on this cache are allowed. + * If topology validator is not configured, then the cluster topology is always considered to be valid. * <p> - * In case topology is not valid for specific cache all update operations on this cache are restricted: + * Whenever the {@link #validate(Collection)} method returns {@code true}, then the topology is considered valid + * for a certain cache and all operations on this cache will be allowed to proceed. Otherwise, all update operations + * on the cache are restricted with the following exceptions: * <ul> - * <li>{@link CacheException} will be thrown at update operations (put, remove, etc) attempt.</li> - * <li>{@link IgniteException} will be thrown at transaction commit attempt.</li> + * <li>{@link CacheException} will be thrown for all update operations (put, remove, etc) attempt.</li> + * <li>{@link IgniteException} will be thrown for the transaction commit attempt.</li> * </ul> - * Usage example - * <p> - * Following validator allows to put data only in case topology contains exactly 2 nodes: - * <pre>{@code + * After returning {@code false} and declaring the topology not valid, the topology validator can return + * to normal state whenever the next topology change happens. + * <h1 class="header">Example</h1> + * The example below shows how a validator can be used to allow cache updates only in case if the cluster + * topology contains exactly 2 nodes: + * <pre name="code" class="java"> * new TopologyValidator() { * public boolean validate(Collection<ClusterNode> nodes) { * return nodes.size() == 2; * } * } - * }</pre> + * </pre> + * <h1 class="header">Configuration</h1> + * The topology validator can be configured either from code or XML via + * {@link CacheConfiguration#setTopologyValidator(TopologyValidator)} method. */ public interface TopologyValidator extends Serializable { /**
