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/06/30 13:06:00 UTC
[3/5] incubator-ignite git commit: IGNITE-1058: Review.
IGNITE-1058: Review.
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/9c6ff399
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/9c6ff399
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/9c6ff399
Branch: refs/heads/ignite-gg-10298
Commit: 9c6ff399f2b215f134b31607ddedc18a7637456b
Parents: 4d731ea
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Tue Jun 30 12:24:17 2015 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Tue Jun 30 12:24:17 2015 +0300
----------------------------------------------------------------------
.../managers/communication/GridIoManager.java | 25 +++++++++-----------
.../communication/IoPoolExtension.java | 9 ++++---
2 files changed, 17 insertions(+), 17 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9c6ff399/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoManager.java b/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoManager.java
index 4d422c6..a58cf73 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoManager.java
@@ -69,6 +69,7 @@ public class GridIoManager extends GridManagerAdapter<CommunicationSpi<Serializa
private final Collection<GridDisconnectListener> disconnectLsnrs = new ConcurrentLinkedQueue<>();
/** Map of {@link IoPoolExtension}-s injected by Ignite plugins. */
+ // TODO: This should not be concurrent map. Either HashMap or array.
private final ConcurrentMap<Byte, IoPoolExtension> ioPoolExtensionMap = new ConcurrentHashMap8<>(128);
/** Public pool. */
@@ -279,30 +280,20 @@ public class GridIoManager extends GridManagerAdapter<CommunicationSpi<Serializa
// 1. Check the pool id is non-negative:
if (id < 0)
- throw new IgniteCheckedException("Failed to register IO executor pool because its Id is negative." +
+ throw new IgniteCheckedException("Failed to register IO executor pool because its Id is negative " +
"[id=" + id + ", pluginId=" + ex.pligunId() + ']');
// 2. Check the pool id is in allowed range:
if (isReservedGridIoPolicy(id))
- throw new IgniteCheckedException("Failed to register IO executor pool because its Id in in the reserved" +
- " range. [id=" + id + ", pluginId="
- + ex.pligunId() + ']');
+ throw new IgniteCheckedException("Failed to register IO executor pool because its Id in in the " +
+ "reserved range (0-31) [id=" + id + ", pluginId=" + ex.pligunId() + ']');
// 3. Check the pool for duplicates:
IoPoolExtension pushedOut = ioPoolExtensionMap.putIfAbsent(id, ex);
if (pushedOut != null)
throw new IgniteCheckedException("Failed to register IO executor pool because its " +
- "Id as already used. [id=" + ex.id() + ", pluginId="
+ "Id as already used [id=" + ex.id() + ", pluginId="
+ ex.pligunId() + ", existingPoolPluginId=" + pushedOut.pligunId() + ']');
-
- // 4. Check the pool has the executor:
- Executor e = ex.executor();
-
- if (e == null) {
- throw new IgniteCheckedException("Failed to register IO executor pool because its " +
- " executor is null. [id=" + id + ", pluginId="
- + ex.pligunId() + ']');
- }
}
}
}
@@ -595,10 +586,14 @@ public class GridIoManager extends GridManagerAdapter<CommunicationSpi<Serializa
}
default:
+ // TODO: Assert.
if (plc < 0)
throw new IgniteException("Failed to process message with negative policy. [policy="
+ plc + ']');
+ // TODO: If from reserved range - ignore.
+ // TODO: If from not-reserved range and IoExtension exists - process.
+ // TODO: If from not-reserved range and IoExtension doesnt exist - ignore.
if (isReservedGridIoPolicy(plc))
throw new IgniteException("Failed to process message with policy of reserved range. [policy="
+ plc + ']');
@@ -653,12 +648,14 @@ public class GridIoManager extends GridManagerAdapter<CommunicationSpi<Serializa
IoPoolExtension pool = ioPoolExtensionMap.get(plc);
+ // TODO: Assert
if (pool == null)
throw new IgniteException("Failed to process message because corresponding executor pool is not "
+ " found. [id=" + plc + ']');
assert plc == pool.id();
+ // TODO: Check for null and throw IgniteCheckedException.
return pool.executor();
}
}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9c6ff399/modules/core/src/main/java/org/apache/ignite/plugin/extensions/communication/IoPoolExtension.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/plugin/extensions/communication/IoPoolExtension.java b/modules/core/src/main/java/org/apache/ignite/plugin/extensions/communication/IoPoolExtension.java
index 2f02f01..f452bfd 100644
--- a/modules/core/src/main/java/org/apache/ignite/plugin/extensions/communication/IoPoolExtension.java
+++ b/modules/core/src/main/java/org/apache/ignite/plugin/extensions/communication/IoPoolExtension.java
@@ -24,21 +24,24 @@ import java.util.concurrent.*;
/**
* The interface of IO Messaging Pool Extension.
*/
+// TODO: IoPoolExtension -> IoPool
public interface IoPoolExtension extends Extension {
/**
- * Gets the numeric identifier of the Pool.
- * This identifier is to be taken from serialized
+ * Gets the numeric identifier of the pool. This identifier is to be taken from serialized
* message and used to find the appropriate executor pool to process it.
+ *
* @return The id.
*/
public byte id();
/**
- * Gets the Executor for this Pool. Must always return the same Executor instance.
+ * Gets the Executor for this Pool. Cannot be null.
+ *
* @return The executor.
*/
public Executor executor();
+ // TODO: Remove.
/**
* Gets the Id of the plugin that injected this executor pool.
* @return The plugin Id.