You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by sb...@apache.org on 2015/04/10 14:11:22 UTC
[47/51] incubator-ignite git commit: sp-3 renaming
sp-3 renaming
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/9b72d7d4
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/9b72d7d4
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/9b72d7d4
Branch: refs/heads/ignite-537
Commit: 9b72d7d4a76088599350eb6b1fd624ddebcfc8e6
Parents: 674635f
Author: Yakov Zhdanov <yz...@gridgain.com>
Authored: Fri Apr 10 14:25:25 2015 +0300
Committer: Yakov Zhdanov <yz...@gridgain.com>
Committed: Fri Apr 10 14:25:25 2015 +0300
----------------------------------------------------------------------
.../java/org/apache/ignite/IgniteState.java | 2 +-
.../configuration/IgniteConfiguration.java | 16 ++---
.../org/apache/ignite/internal/IgnitionEx.java | 4 +-
.../discovery/GridDiscoveryManager.java | 4 +-
.../node/VisorSegmentationConfiguration.java | 4 +-
.../segmentation/GridSegmentationPolicy.java | 47 --------------
.../segmentation/GridSegmentationResolver.java | 64 -------------------
.../plugin/segmentation/SegmentationPolicy.java | 49 +++++++++++++++
.../segmentation/SegmentationResolver.java | 65 ++++++++++++++++++++
.../internal/GridLifecycleAwareSelfTest.java | 2 +-
10 files changed, 130 insertions(+), 127 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9b72d7d4/modules/core/src/main/java/org/apache/ignite/IgniteState.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/IgniteState.java b/modules/core/src/main/java/org/apache/ignite/IgniteState.java
index 05f9bdc..1b8b193 100644
--- a/modules/core/src/main/java/org/apache/ignite/IgniteState.java
+++ b/modules/core/src/main/java/org/apache/ignite/IgniteState.java
@@ -40,7 +40,7 @@ public enum IgniteState {
* Grid factory stopped due to network segmentation issues.
* <p>
* Notification on this state will be fired only when segmentation policy is
- * set to {@link GridSegmentationPolicy#STOP} or {@link GridSegmentationPolicy#RESTART_JVM}
+ * set to {@link SegmentationPolicy#STOP} or {@link SegmentationPolicy#RESTART_JVM}
* and node is stopped from internals of Ignite after segment becomes invalid.
*/
STOPPED_ON_SEGMENTATION;
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9b72d7d4/modules/core/src/main/java/org/apache/ignite/configuration/IgniteConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/configuration/IgniteConfiguration.java b/modules/core/src/main/java/org/apache/ignite/configuration/IgniteConfiguration.java
index 4edda55..101d8a7 100644
--- a/modules/core/src/main/java/org/apache/ignite/configuration/IgniteConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/configuration/IgniteConfiguration.java
@@ -60,7 +60,7 @@ import javax.management.*;
import java.lang.management.*;
import java.util.*;
-import static org.apache.ignite.plugin.segmentation.GridSegmentationPolicy.*;
+import static org.apache.ignite.plugin.segmentation.SegmentationPolicy.*;
/**
* This class defines grid runtime configuration. This configuration is passed to
@@ -158,7 +158,7 @@ public class IgniteConfiguration {
public static final int DFLT_MGMT_THREAD_CNT = 4;
/** Default segmentation policy. */
- public static final GridSegmentationPolicy DFLT_SEG_PLC = STOP;
+ public static final SegmentationPolicy DFLT_SEG_PLC = STOP;
/** Default value for wait for segment on startup flag. */
public static final boolean DFLT_WAIT_FOR_SEG_ON_START = true;
@@ -269,10 +269,10 @@ public class IgniteConfiguration {
private DiscoverySpi discoSpi;
/** Segmentation policy. */
- private GridSegmentationPolicy segPlc = DFLT_SEG_PLC;
+ private SegmentationPolicy segPlc = DFLT_SEG_PLC;
/** Segmentation resolvers. */
- private GridSegmentationResolver[] segResolvers;
+ private SegmentationResolver[] segResolvers;
/** Segmentation resolve attempts count. */
private int segResolveAttempts = DFLT_SEG_RESOLVE_ATTEMPTS;
@@ -1154,7 +1154,7 @@ public class IgniteConfiguration {
*
* @return Segmentation policy.
*/
- public GridSegmentationPolicy getSegmentationPolicy() {
+ public SegmentationPolicy getSegmentationPolicy() {
return segPlc;
}
@@ -1163,7 +1163,7 @@ public class IgniteConfiguration {
*
* @param segPlc Segmentation policy.
*/
- public void setSegmentationPolicy(GridSegmentationPolicy segPlc) {
+ public void setSegmentationPolicy(SegmentationPolicy segPlc) {
this.segPlc = segPlc;
}
@@ -1247,7 +1247,7 @@ public class IgniteConfiguration {
*
* @return Segmentation resolvers.
*/
- public GridSegmentationResolver[] getSegmentationResolvers() {
+ public SegmentationResolver[] getSegmentationResolvers() {
return segResolvers;
}
@@ -1256,7 +1256,7 @@ public class IgniteConfiguration {
*
* @param segResolvers Segmentation resolvers.
*/
- public void setSegmentationResolvers(GridSegmentationResolver... segResolvers) {
+ public void setSegmentationResolvers(SegmentationResolver... segResolvers) {
this.segResolvers = segResolvers;
}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9b72d7d4/modules/core/src/main/java/org/apache/ignite/internal/IgnitionEx.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/IgnitionEx.java b/modules/core/src/main/java/org/apache/ignite/internal/IgnitionEx.java
index c7dfd19..ac9bc33 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/IgnitionEx.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/IgnitionEx.java
@@ -71,7 +71,7 @@ import static org.apache.ignite.cache.CacheRebalanceMode.*;
import static org.apache.ignite.cache.CacheWriteSynchronizationMode.*;
import static org.apache.ignite.configuration.IgniteConfiguration.*;
import static org.apache.ignite.internal.IgniteComponentType.*;
-import static org.apache.ignite.plugin.segmentation.GridSegmentationPolicy.*;
+import static org.apache.ignite.plugin.segmentation.SegmentationPolicy.*;
/**
* This class defines a factory for the main Ignite API. It controls Grid life cycle
@@ -1552,7 +1552,7 @@ public class IgnitionEx {
myCfg.setIgniteHome(ggHome);
// Validate segmentation configuration.
- GridSegmentationPolicy segPlc = cfg.getSegmentationPolicy();
+ SegmentationPolicy segPlc = cfg.getSegmentationPolicy();
// 1. Warn on potential configuration problem: grid is not configured to wait
// for correct segment after segmentation happens.
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9b72d7d4/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java b/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java
index adbfa76..299b3c2 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java
@@ -57,7 +57,7 @@ import static java.util.concurrent.TimeUnit.*;
import static org.apache.ignite.events.EventType.*;
import static org.apache.ignite.internal.IgniteNodeAttributes.*;
import static org.apache.ignite.internal.IgniteVersionUtils.*;
-import static org.apache.ignite.plugin.segmentation.GridSegmentationPolicy.*;
+import static org.apache.ignite.plugin.segmentation.SegmentationPolicy.*;
/**
* Discovery SPI manager.
@@ -1727,7 +1727,7 @@ public class GridDiscoveryManager extends GridManagerAdapter<DiscoverySpi> {
*
*/
private void onSegmentation() {
- GridSegmentationPolicy segPlc = ctx.config().getSegmentationPolicy();
+ SegmentationPolicy segPlc = ctx.config().getSegmentationPolicy();
// Always disconnect first.
try {
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9b72d7d4/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorSegmentationConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorSegmentationConfiguration.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorSegmentationConfiguration.java
index d712774..ebc8252 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorSegmentationConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorSegmentationConfiguration.java
@@ -34,7 +34,7 @@ public class VisorSegmentationConfiguration implements Serializable {
private static final long serialVersionUID = 0L;
/** Segmentation policy. */
- private GridSegmentationPolicy plc;
+ private SegmentationPolicy plc;
/** Segmentation resolvers. */
private String resolvers;
@@ -67,7 +67,7 @@ public class VisorSegmentationConfiguration implements Serializable {
/**
* @return Segmentation policy.
*/
- public GridSegmentationPolicy policy() {
+ public SegmentationPolicy policy() {
return plc;
}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9b72d7d4/modules/core/src/main/java/org/apache/ignite/plugin/segmentation/GridSegmentationPolicy.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/plugin/segmentation/GridSegmentationPolicy.java b/modules/core/src/main/java/org/apache/ignite/plugin/segmentation/GridSegmentationPolicy.java
deleted file mode 100644
index c43d00c..0000000
--- a/modules/core/src/main/java/org/apache/ignite/plugin/segmentation/GridSegmentationPolicy.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.plugin.segmentation;
-
-/**
- * Policy that defines how node will react on topology segmentation. Note that default
- * segmentation policy is defined by {@link org.apache.ignite.configuration.IgniteConfiguration#DFLT_SEG_PLC} property.
- * @see GridSegmentationResolver
- */
-public enum GridSegmentationPolicy {
- /**
- * When segmentation policy is {@code RESTART_JVM}, all listeners will receive
- * {@link org.apache.ignite.events.EventType#EVT_NODE_SEGMENTED} event and then JVM will be restarted.
- * Note, that this will work <b>only</b> if Ignite is started with {@link org.apache.ignite.startup.cmdline.CommandLineStartup}
- * via standard {@code ignite.{sh|bat}} shell script.
- */
- RESTART_JVM,
-
- /**
- * When segmentation policy is {@code STOP}, all listeners will receive
- * {@link org.apache.ignite.events.EventType#EVT_NODE_SEGMENTED} event and then particular grid node
- * will be stopped via call to {@link org.apache.ignite.Ignition#stop(String, boolean)}.
- */
- STOP,
-
- /**
- * When segmentation policy is {@code NOOP}, all listeners will receive
- * {@link org.apache.ignite.events.EventType#EVT_NODE_SEGMENTED} event and it is up to user to
- * implement logic to handle this event.
- */
- NOOP
-}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9b72d7d4/modules/core/src/main/java/org/apache/ignite/plugin/segmentation/GridSegmentationResolver.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/plugin/segmentation/GridSegmentationResolver.java b/modules/core/src/main/java/org/apache/ignite/plugin/segmentation/GridSegmentationResolver.java
deleted file mode 100644
index 4076870..0000000
--- a/modules/core/src/main/java/org/apache/ignite/plugin/segmentation/GridSegmentationResolver.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.plugin.segmentation;
-
-import org.apache.ignite.*;
-
-import java.io.*;
-
-/**
- * This is interface for segmentation (a.k.a "split-brain" problem) resolvers.
- * <p>
- * Each segmentation resolver checks segment for validity, using its inner logic.
- * Typically, resolver should run light-weight single check (i.e. one IP address or
- * one shared folder). Compound segment checks may be performed using several
- * resolvers.
- * <p>
- * Note that Ignite support a logical segmentation and not limited to network
- * related segmentation only. For example, a particular segmentation resolver
- * can check for specific application or service present on the network and
- * mark the topology as segmented in case it is not available. In other words
- * you can equate the service outage with network outage via segmentation resolution
- * and employ the unified approach in dealing with these types of problems.
- * @see org.apache.ignite.configuration.IgniteConfiguration#getSegmentationResolvers()
- * @see org.apache.ignite.configuration.IgniteConfiguration#getSegmentationPolicy()
- * @see org.apache.ignite.configuration.IgniteConfiguration#getSegmentCheckFrequency()
- * @see org.apache.ignite.configuration.IgniteConfiguration#isAllSegmentationResolversPassRequired()
- * @see org.apache.ignite.configuration.IgniteConfiguration#isWaitForSegmentOnStart()
- * @see GridSegmentationPolicy
- */
-public interface GridSegmentationResolver extends Serializable {
- /**
- * Checks whether segment is valid.
- * <p>
- * When segmentation happens every node ends up in either one of two segments:
- * <ul>
- * <li>Correct segment</li>
- * <li>Invalid segment</li>
- * </ul>
- * Nodes in correct segment will continue operate as if nodes in the invalid segment
- * simply left the topology (i.e. the topology just got "smaller"). Nodes in the
- * invalid segment will realized that were "left out or disconnected" from the correct segment
- * and will try to reconnect via {@link GridSegmentationPolicy segmentation policy} set
- * in configuration.
- *
- * @return {@code True} if segment is correct, {@code false} otherwise.
- * @throws IgniteCheckedException If an error occurred.
- */
- public abstract boolean isValidSegment() throws IgniteCheckedException;
-}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9b72d7d4/modules/core/src/main/java/org/apache/ignite/plugin/segmentation/SegmentationPolicy.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/plugin/segmentation/SegmentationPolicy.java b/modules/core/src/main/java/org/apache/ignite/plugin/segmentation/SegmentationPolicy.java
new file mode 100644
index 0000000..df310cd
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/plugin/segmentation/SegmentationPolicy.java
@@ -0,0 +1,49 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.plugin.segmentation;
+
+import org.apache.ignite.configuration.IgniteConfiguration;
+
+/**
+ * Policy that defines how node will react on topology segmentation. Note that default
+ * segmentation policy is defined by {@link IgniteConfiguration#DFLT_SEG_PLC} property.
+ * @see SegmentationResolver
+ */
+public enum SegmentationPolicy {
+ /**
+ * When segmentation policy is {@code RESTART_JVM}, all listeners will receive
+ * {@link org.apache.ignite.events.EventType#EVT_NODE_SEGMENTED} event and then JVM will be restarted.
+ * Note, that this will work <b>only</b> if Ignite is started with {@link org.apache.ignite.startup.cmdline.CommandLineStartup}
+ * via standard {@code ignite.{sh|bat}} shell script.
+ */
+ RESTART_JVM,
+
+ /**
+ * When segmentation policy is {@code STOP}, all listeners will receive
+ * {@link org.apache.ignite.events.EventType#EVT_NODE_SEGMENTED} event and then particular grid node
+ * will be stopped via call to {@link org.apache.ignite.Ignition#stop(String, boolean)}.
+ */
+ STOP,
+
+ /**
+ * When segmentation policy is {@code NOOP}, all listeners will receive
+ * {@link org.apache.ignite.events.EventType#EVT_NODE_SEGMENTED} event and it is up to user to
+ * implement logic to handle this event.
+ */
+ NOOP
+}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9b72d7d4/modules/core/src/main/java/org/apache/ignite/plugin/segmentation/SegmentationResolver.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/plugin/segmentation/SegmentationResolver.java b/modules/core/src/main/java/org/apache/ignite/plugin/segmentation/SegmentationResolver.java
new file mode 100644
index 0000000..e34cf61
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/plugin/segmentation/SegmentationResolver.java
@@ -0,0 +1,65 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.plugin.segmentation;
+
+import org.apache.ignite.*;
+import org.apache.ignite.configuration.*;
+
+import java.io.*;
+
+/**
+ * This is interface for segmentation (a.k.a "split-brain" problem) resolvers.
+ * <p>
+ * Each segmentation resolver checks segment for validity, using its inner logic.
+ * Typically, resolver should run light-weight single check (i.e. one IP address or
+ * one shared folder). Compound segment checks may be performed using several
+ * resolvers.
+ * <p>
+ * Note that Ignite support a logical segmentation and not limited to network
+ * related segmentation only. For example, a particular segmentation resolver
+ * can check for specific application or service present on the network and
+ * mark the topology as segmented in case it is not available. In other words
+ * you can equate the service outage with network outage via segmentation resolution
+ * and employ the unified approach in dealing with these types of problems.
+ * @see IgniteConfiguration#getSegmentationResolvers()
+ * @see IgniteConfiguration#getSegmentationPolicy()
+ * @see IgniteConfiguration#getSegmentCheckFrequency()
+ * @see IgniteConfiguration#isAllSegmentationResolversPassRequired()
+ * @see IgniteConfiguration#isWaitForSegmentOnStart()
+ * @see SegmentationPolicy
+ */
+public interface SegmentationResolver extends Serializable {
+ /**
+ * Checks whether segment is valid.
+ * <p>
+ * When segmentation happens every node ends up in either one of two segments:
+ * <ul>
+ * <li>Correct segment</li>
+ * <li>Invalid segment</li>
+ * </ul>
+ * Nodes in correct segment will continue operate as if nodes in the invalid segment
+ * simply left the topology (i.e. the topology just got "smaller"). Nodes in the
+ * invalid segment will realized that were "left out or disconnected" from the correct segment
+ * and will try to reconnect via {@link SegmentationPolicy segmentation policy} set
+ * in configuration.
+ *
+ * @return {@code True} if segment is correct, {@code false} otherwise.
+ * @throws IgniteCheckedException If an error occurred.
+ */
+ public abstract boolean isValidSegment() throws IgniteCheckedException;
+}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9b72d7d4/modules/core/src/test/java/org/apache/ignite/internal/GridLifecycleAwareSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/GridLifecycleAwareSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/GridLifecycleAwareSelfTest.java
index 39b673c..112f5c5 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/GridLifecycleAwareSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/GridLifecycleAwareSelfTest.java
@@ -56,7 +56,7 @@ public class GridLifecycleAwareSelfTest extends GridAbstractLifecycleAwareSelfTe
/**
*/
- private static class TestSegmentationResolver extends TestLifecycleAware implements GridSegmentationResolver {
+ private static class TestSegmentationResolver extends TestLifecycleAware implements SegmentationResolver {
/**
*/
TestSegmentationResolver() {