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 2017/03/16 07:52:54 UTC
[1/8] ignite git commit: IGNITE-4819 Start .NET plugins before
OnIgniteStart
Repository: ignite
Updated Branches:
refs/heads/ignite-4768-1 3df67c6a1 -> e012ca3c5
IGNITE-4819 Start .NET plugins before OnIgniteStart
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/5db0c020
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/5db0c020
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/5db0c020
Branch: refs/heads/ignite-4768-1
Commit: 5db0c020913bd102a910705b7614ff5ed9c56629
Parents: 901be4f
Author: Pavel Tupitsyn <pt...@apache.org>
Authored: Tue Mar 14 17:18:40 2017 +0300
Committer: Pavel Tupitsyn <pt...@apache.org>
Committed: Tue Mar 14 17:18:40 2017 +0300
----------------------------------------------------------------------
.../Apache.Ignite.Core.Tests/Plugin/PluginTest.cs | 1 -
.../Plugin/TestIgnitePluginProvider.cs | 13 ++++++++-----
.../Apache.Ignite.Core/Impl/Plugin/PluginProcessor.cs | 12 ++++++++++--
3 files changed, 18 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/5db0c020/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Plugin/PluginTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Plugin/PluginTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Plugin/PluginTest.cs
index efb14ff..b6c00b5 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Plugin/PluginTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Plugin/PluginTest.cs
@@ -173,7 +173,6 @@ namespace Apache.Ignite.Core.Tests.Plugin
new[]
{
"normalPlugin.Start", "errPlugin.Start",
- "errPlugin.OnIgniteStop", "normalPlugin.OnIgniteStop",
"errPlugin.Stop", "normalPlugin.Stop"
}, PluginLog);
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/5db0c020/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Plugin/TestIgnitePluginProvider.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Plugin/TestIgnitePluginProvider.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Plugin/TestIgnitePluginProvider.cs
index 161d797..7282e92 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Plugin/TestIgnitePluginProvider.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Plugin/TestIgnitePluginProvider.cs
@@ -83,7 +83,7 @@ namespace Apache.Ignite.Core.Tests.Plugin
Context = context;
- EnsureIgniteWorks();
+ EnsureIgniteWorks(false);
}
/** <inheritdoc /> */
@@ -91,7 +91,7 @@ namespace Apache.Ignite.Core.Tests.Plugin
{
Stopped = cancel;
- EnsureIgniteWorks();
+ EnsureIgniteWorks(false);
}
/** <inheritdoc /> */
@@ -135,16 +135,19 @@ namespace Apache.Ignite.Core.Tests.Plugin
/// <summary>
/// Ensures that Ignite instance is functional.
/// </summary>
- private void EnsureIgniteWorks()
+ private void EnsureIgniteWorks(bool checkCache = true)
{
Assert.NotNull(Context);
Assert.NotNull(Context.Ignite);
Assert.NotNull(Context.IgniteConfiguration);
Assert.NotNull(Context.PluginConfiguration);
- var cache = Context.Ignite.GetOrCreateCache<int, int>("pluginCache");
+ if (checkCache)
+ {
+ var cache = Context.Ignite.GetOrCreateCache<int, int>("pluginCache");
- Assert.AreEqual(0, cache.GetSize());
+ Assert.AreEqual(0, cache.GetSize());
+ }
}
}
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/5db0c020/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Plugin/PluginProcessor.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Plugin/PluginProcessor.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Plugin/PluginProcessor.cs
index 7ed7141..11100ff 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Plugin/PluginProcessor.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Plugin/PluginProcessor.cs
@@ -62,6 +62,16 @@ namespace Apache.Ignite.Core.Impl.Plugin
Debug.Assert(ignite != null);
_ignite = ignite;
+
+ try
+ {
+ LoadPlugins();
+ }
+ catch (Exception)
+ {
+ Stop(true);
+ throw;
+ }
}
/// <summary>
@@ -85,8 +95,6 @@ namespace Apache.Ignite.Core.Impl.Plugin
/// </summary>
public void OnIgniteStart()
{
- LoadPlugins();
-
// Notify plugins.
foreach (var provider in _pluginProviders)
provider.OnIgniteStart();
[7/8] ignite git commit: Merge remote-tracking branch
'remotes/origin/ignite-2.0' into ignite-4768-1
Posted by sb...@apache.org.
Merge remote-tracking branch 'remotes/origin/ignite-2.0' into ignite-4768-1
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/4072b9f2
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/4072b9f2
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/4072b9f2
Branch: refs/heads/ignite-4768-1
Commit: 4072b9f26494b0aed19401ba2b97829ed24dd134
Parents: bbec344 4820c45
Author: sboikov <sb...@gridgain.com>
Authored: Thu Mar 16 10:26:20 2017 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Thu Mar 16 10:26:20 2017 +0300
----------------------------------------------------------------------
.../platform/PlatformAbstractTarget.java | 8 ++
.../platform/PlatformAsyncResult.java | 41 +++++++++
.../platform/PlatformContextImpl.java | 10 +--
.../processors/platform/PlatformTarget.java | 10 +++
.../platform/PlatformTargetProxy.java | 9 ++
.../platform/PlatformTargetProxyImpl.java | 39 +++++++++
.../platform/PlatformComputeEchoTask.java | 6 ++
.../plugin/PlatformTestPluginTarget.java | 89 +++++++++++++++++++-
.../cpp/jni/include/ignite/jni/exports.h | 1 +
.../platforms/cpp/jni/include/ignite/jni/java.h | 2 +
modules/platforms/cpp/jni/project/vs/module.def | 1 +
modules/platforms/cpp/jni/src/exports.cpp | 4 +
modules/platforms/cpp/jni/src/java.cpp | 10 +++
.../Binary/BinaryReaderWriterTest.cs | 8 ++
.../Compute/ComputeApiTest.cs | 19 +++++
.../ConsoleRedirectTest.cs | 2 +-
.../Plugin/PluginTest.cs | 42 ++++++++-
.../Plugin/TestIgnitePluginProvider.cs | 13 +--
.../Apache.Ignite.Core/Common/IgniteGuid.cs | 47 +++++++----
.../Apache.Ignite.Core/Events/CacheEvent.cs | 2 +-
.../Apache.Ignite.Core/Events/EventBase.cs | 4 +-
.../Apache.Ignite.Core/Events/JobEvent.cs | 4 +-
.../Apache.Ignite.Core/Events/TaskEvent.cs | 2 +-
.../Impl/Binary/BinaryReader.cs | 4 +-
.../Impl/Binary/BinarySystemHandlers.cs | 2 +-
.../Impl/Binary/BinaryUtils.cs | 11 ++-
.../Impl/Binary/Marshaller.cs | 4 +-
.../Apache.Ignite.Core/Impl/PlatformTarget.cs | 29 +++++++
.../Impl/Plugin/PluginContext.cs | 9 ++
.../Impl/Plugin/PluginProcessor.cs | 12 ++-
.../Impl/Unmanaged/IgniteJniNativeMethods.cs | 3 +
.../Impl/Unmanaged/UnmanagedUtils.cs | 5 ++
.../Interop/IPlatformTarget.cs | 13 +++
.../Apache.Ignite.Core/Plugin/IPluginContext.cs | 8 ++
34 files changed, 425 insertions(+), 48 deletions(-)
----------------------------------------------------------------------
[4/8] ignite git commit: IGNITE-4716 .NET: Add IgniteUuid system type
support
Posted by sb...@apache.org.
IGNITE-4716 .NET: Add IgniteUuid system type support
This closes #1618
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/8e5e3cbf
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/8e5e3cbf
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/8e5e3cbf
Branch: refs/heads/ignite-4768-1
Commit: 8e5e3cbf35976fc57652906f26c86e25a561b41a
Parents: 637c18d
Author: Pavel Tupitsyn <pt...@apache.org>
Authored: Wed Mar 15 14:04:31 2017 +0300
Committer: Pavel Tupitsyn <pt...@apache.org>
Committed: Wed Mar 15 14:04:31 2017 +0300
----------------------------------------------------------------------
.../platform/PlatformContextImpl.java | 10 ++---
.../platform/PlatformComputeEchoTask.java | 6 +++
.../Binary/BinaryReaderWriterTest.cs | 8 ++++
.../Compute/ComputeApiTest.cs | 19 ++++++++
.../Apache.Ignite.Core/Common/IgniteGuid.cs | 47 +++++++++++++-------
.../Apache.Ignite.Core/Events/CacheEvent.cs | 2 +-
.../Apache.Ignite.Core/Events/EventBase.cs | 4 +-
.../Apache.Ignite.Core/Events/JobEvent.cs | 4 +-
.../Apache.Ignite.Core/Events/TaskEvent.cs | 2 +-
.../Impl/Binary/BinaryReader.cs | 4 +-
.../Impl/Binary/BinarySystemHandlers.cs | 2 +-
.../Impl/Binary/BinaryUtils.cs | 11 +++--
.../Impl/Binary/Marshaller.cs | 4 +-
13 files changed, 88 insertions(+), 35 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/8e5e3cbf/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformContextImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformContextImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformContextImpl.java
index 6cec7a1..8f7d5de 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformContextImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformContextImpl.java
@@ -510,7 +510,7 @@ public class PlatformContextImpl implements PlatformContext {
writer.writeBoolean(event0.isNear());
writeNode(writer, event0.eventNode());
writer.writeObject(event0.key());
- PlatformUtils.writeIgniteUuid(writer, event0.xid());
+ writer.writeObject(event0.xid());
writer.writeObject(event0.newValue());
writer.writeObject(event0.oldValue());
writer.writeBoolean(event0.hasOldValue());
@@ -589,8 +589,8 @@ public class PlatformContextImpl implements PlatformContext {
writer.writeString(event0.taskName());
writer.writeString(event0.taskClassName());
- PlatformUtils.writeIgniteUuid(writer, event0.taskSessionId());
- PlatformUtils.writeIgniteUuid(writer, event0.jobId());
+ writer.writeObject(event0.taskSessionId());
+ writer.writeObject(event0.jobId());
writeNode(writer, event0.taskNode());
writer.writeUuid(event0.taskSubjectId());
}
@@ -610,7 +610,7 @@ public class PlatformContextImpl implements PlatformContext {
writer.writeString(event0.taskName());
writer.writeString(event0.taskClassName());
- PlatformUtils.writeIgniteUuid(writer, event0.taskSessionId());
+ writer.writeObject(event0.taskSessionId());
writer.writeBoolean(event0.internal());
writer.writeUuid(event0.subjectId());
}
@@ -625,7 +625,7 @@ public class PlatformContextImpl implements PlatformContext {
* @param evt Event.
*/
private void writeCommonEventData(BinaryRawWriterEx writer, EventAdapter evt) {
- PlatformUtils.writeIgniteUuid(writer, evt.id());
+ writer.writeObject(evt.id());
writer.writeLong(evt.localOrder());
writeNode(writer, evt.node());
writer.writeString(evt.message());
http://git-wip-us.apache.org/repos/asf/ignite/blob/8e5e3cbf/modules/core/src/test/java/org/apache/ignite/platform/PlatformComputeEchoTask.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/platform/PlatformComputeEchoTask.java b/modules/core/src/test/java/org/apache/ignite/platform/PlatformComputeEchoTask.java
index 036491f..540daa2 100644
--- a/modules/core/src/test/java/org/apache/ignite/platform/PlatformComputeEchoTask.java
+++ b/modules/core/src/test/java/org/apache/ignite/platform/PlatformComputeEchoTask.java
@@ -107,6 +107,9 @@ public class PlatformComputeEchoTask extends ComputeTaskAdapter<Integer, Object>
/** Type: enum array from cache. */
private static final int TYPE_ENUM_ARRAY_FROM_CACHE = 21;
+ /** Type: ignite uuid. */
+ private static final int TYPE_IGNITE_UUID = 22;
+
/** {@inheritDoc} */
@Nullable @Override public Map<? extends ComputeJob, ClusterNode> map(List<ClusterNode> subgrid,
@Nullable Integer arg) {
@@ -219,6 +222,9 @@ public class PlatformComputeEchoTask extends ComputeTaskAdapter<Integer, Object>
case TYPE_AFFINITY_KEY:
return new AffinityKey<>("interopAffinityKey");
+ case TYPE_IGNITE_UUID:
+ return ignite.cache(null).get(TYPE_IGNITE_UUID);
+
default:
throw new IgniteException("Unknown type: " + type);
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/8e5e3cbf/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinaryReaderWriterTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinaryReaderWriterTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinaryReaderWriterTest.cs
index c17caff..ffbd084 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinaryReaderWriterTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinaryReaderWriterTest.cs
@@ -92,12 +92,14 @@ namespace Apache.Ignite.Core.Tests.Binary
writer.WriteDouble("Double", 1);
writer.WriteDoubleArray("DoubleArray", new double[] {1});
writer.WriteDecimal("Decimal", 1);
+ writer.WriteDecimal("DecimalN", null);
writer.WriteDecimalArray("DecimalArray", new decimal?[] {1});
writer.WriteTimestamp("Timestamp", Date);
writer.WriteTimestampArray("TimestampArray", new DateTime?[] {Date});
writer.WriteString("String", "1");
writer.WriteStringArray("StringArray", new[] {"1"});
writer.WriteGuid("Guid", Guid);
+ writer.WriteGuid("GuidN", null);
writer.WriteGuidArray("GuidArray", new Guid?[] {Guid});
writer.WriteEnum("Enum", MyEnum.Bar);
writer.WriteEnumArray("EnumArray", new[] {MyEnum.Bar});
@@ -121,12 +123,14 @@ namespace Apache.Ignite.Core.Tests.Binary
raw.WriteDouble(1);
raw.WriteDoubleArray(new double[] {1});
raw.WriteDecimal(1);
+ raw.WriteDecimal(null);
raw.WriteDecimalArray(new decimal?[] {1});
raw.WriteTimestamp(Date);
raw.WriteTimestampArray(new DateTime?[] {Date});
raw.WriteString("1");
raw.WriteStringArray(new[] {"1"});
raw.WriteGuid(Guid);
+ raw.WriteGuid(null);
raw.WriteGuidArray(new Guid?[] {Guid});
raw.WriteEnum(MyEnum.Bar);
raw.WriteEnumArray(new[] {MyEnum.Bar});
@@ -151,12 +155,14 @@ namespace Apache.Ignite.Core.Tests.Binary
Assert.AreEqual(1, reader.ReadDouble("Double"));
Assert.AreEqual(new double[] {1}, reader.ReadDoubleArray("DoubleArray"));
Assert.AreEqual(1, reader.ReadDecimal("Decimal"));
+ Assert.AreEqual(null, reader.ReadDecimal("DecimalN"));
Assert.AreEqual(new decimal?[] {1}, reader.ReadDecimalArray("DecimalArray"));
Assert.AreEqual(Date, reader.ReadTimestamp("Timestamp"));
Assert.AreEqual(new DateTime?[] {Date}, reader.ReadTimestampArray("TimestampArray"));
Assert.AreEqual("1", reader.ReadString("String"));
Assert.AreEqual(new[] {"1"}, reader.ReadStringArray("StringArray"));
Assert.AreEqual(Guid, reader.ReadGuid("Guid"));
+ Assert.AreEqual(null, reader.ReadGuid("GuidN"));
Assert.AreEqual(new Guid?[] {Guid}, reader.ReadGuidArray("GuidArray"));
Assert.AreEqual(MyEnum.Bar, reader.ReadEnum<MyEnum>("Enum"));
Assert.AreEqual(new[] {MyEnum.Bar}, reader.ReadEnumArray<MyEnum>("EnumArray"));
@@ -180,12 +186,14 @@ namespace Apache.Ignite.Core.Tests.Binary
Assert.AreEqual(1, raw.ReadDouble());
Assert.AreEqual(new double[] { 1 }, raw.ReadDoubleArray());
Assert.AreEqual(1, raw.ReadDecimal());
+ Assert.AreEqual(null, raw.ReadDecimal());
Assert.AreEqual(new decimal?[] { 1 }, raw.ReadDecimalArray());
Assert.AreEqual(Date, raw.ReadTimestamp());
Assert.AreEqual(new DateTime?[] { Date }, raw.ReadTimestampArray());
Assert.AreEqual("1", raw.ReadString());
Assert.AreEqual(new[] { "1" }, raw.ReadStringArray());
Assert.AreEqual(Guid, raw.ReadGuid());
+ Assert.AreEqual(null, raw.ReadGuid());
Assert.AreEqual(new Guid?[] { Guid }, raw.ReadGuidArray());
Assert.AreEqual(MyEnum.Bar, raw.ReadEnum<MyEnum>());
Assert.AreEqual(new[] { MyEnum.Bar }, raw.ReadEnumArray<MyEnum>());
http://git-wip-us.apache.org/repos/asf/ignite/blob/8e5e3cbf/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/ComputeApiTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/ComputeApiTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/ComputeApiTest.cs
index da3ef1a..0125466 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/ComputeApiTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/ComputeApiTest.cs
@@ -118,6 +118,9 @@ namespace Apache.Ignite.Core.Tests.Compute
/** Type: enum array from cache. */
private const int EchoTypeEnumArrayFromCache = 21;
+
+ /** Echo type: IgniteUuid. */
+ private const int EchoTypeIgniteUuid = 22;
/** First node. */
private IIgnite _grid1;
@@ -1032,6 +1035,22 @@ namespace Apache.Ignite.Core.Tests.Compute
}
/// <summary>
+ /// Tests that IgniteGuid in .NET maps to IgniteUuid in Java.
+ /// </summary>
+ [Test]
+ public void TestEchoTaskIgniteUuid()
+ {
+ var guid = Guid.NewGuid();
+
+ _grid1.GetCache<int, object>(null)[EchoTypeIgniteUuid] = new IgniteGuid(guid, 25);
+
+ var res = _grid1.GetCompute().ExecuteJavaTask<IgniteGuid>(EchoTask, EchoTypeIgniteUuid);
+
+ Assert.AreEqual(guid, res.GlobalId);
+ Assert.AreEqual(25, res.LocalId);
+ }
+
+ /// <summary>
/// Test for binary argument in Java.
/// </summary>
[Test]
http://git-wip-us.apache.org/repos/asf/ignite/blob/8e5e3cbf/modules/platforms/dotnet/Apache.Ignite.Core/Common/IgniteGuid.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Common/IgniteGuid.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Common/IgniteGuid.cs
index 10fbb2e..b686f9b 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Common/IgniteGuid.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Common/IgniteGuid.cs
@@ -18,14 +18,16 @@
namespace Apache.Ignite.Core.Common
{
using System;
+ using System.Diagnostics;
using System.Globalization;
using Apache.Ignite.Core.Binary;
+ using Apache.Ignite.Core.Impl.Binary;
/// <summary>
/// Ignite guid with additional local ID.
/// </summary>
[Serializable]
- public struct IgniteGuid : IEquatable<IgniteGuid>
+ public struct IgniteGuid : IEquatable<IgniteGuid>, IBinaryWriteAware
{
/** Global id. */
private readonly Guid _globalId;
@@ -45,6 +47,20 @@ namespace Apache.Ignite.Core.Common
}
/// <summary>
+ /// Initializes a new instance of the <see cref="IgniteGuid"/> struct.
+ /// </summary>
+ /// <param name="reader">The reader.</param>
+ internal IgniteGuid(IBinaryRawReader reader)
+ {
+ Debug.Assert(reader != null);
+
+ var stream = ((BinaryReader) reader).Stream;
+
+ _localId = stream.ReadLong();
+ _globalId = BinaryUtils.ReadGuid(stream);
+ }
+
+ /// <summary>
/// Gets the global id.
/// </summary>
public Guid GlobalId
@@ -90,20 +106,6 @@ namespace Apache.Ignite.Core.Common
}
/// <summary>
- /// Reads this object from the given reader.
- /// </summary>
- /// <param name="r">Reader.</param>
- internal static IgniteGuid? Read(IBinaryRawReader r)
- {
- var guid = r.ReadGuid();
-
- if (guid == null)
- return null;
-
- return new IgniteGuid(guid.Value, r.ReadLong());
- }
-
- /// <summary>
/// Implements the operator ==.
/// </summary>
/// <param name="a">First item.</param>
@@ -128,5 +130,20 @@ namespace Apache.Ignite.Core.Common
{
return !(a == b);
}
+
+ /// <summary>
+ /// Writes this object to the given writer.
+ /// </summary>
+ /// <param name="writer">Writer.</param>
+ /// <exception cref="System.NotImplementedException"></exception>
+ void IBinaryWriteAware.WriteBinary(IBinaryWriter writer)
+ {
+ Debug.Assert(writer != null);
+
+ var stream = ((BinaryWriter) writer.GetRawWriter()).Stream;
+
+ stream.WriteLong(_localId);
+ BinaryUtils.WriteGuid(_globalId, stream);
+ }
}
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/8e5e3cbf/modules/platforms/dotnet/Apache.Ignite.Core/Events/CacheEvent.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Events/CacheEvent.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Events/CacheEvent.cs
index ec22fad..62687b9 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Events/CacheEvent.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Events/CacheEvent.cs
@@ -79,7 +79,7 @@ namespace Apache.Ignite.Core.Events
_isNear = r.ReadBoolean();
_eventNode = ReadNode(r);
_key = r.ReadObject<object>();
- _xid = IgniteGuid.Read(r);
+ _xid = r.ReadObject<IgniteGuid?>();
_newValue = r.ReadObject<object>();
_oldValue = r.ReadObject<object>();
_hasOldValue = r.ReadBoolean();
http://git-wip-us.apache.org/repos/asf/ignite/blob/8e5e3cbf/modules/platforms/dotnet/Apache.Ignite.Core/Events/EventBase.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Events/EventBase.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Events/EventBase.cs
index 4992266..8aa446a 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Events/EventBase.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Events/EventBase.cs
@@ -58,9 +58,7 @@ namespace Apache.Ignite.Core.Events
/// <param name="r">The reader to read data from.</param>
protected EventBase(IBinaryRawReader r)
{
- var id = IgniteGuid.Read(r);
- Debug.Assert(id.HasValue);
- _id = id.Value;
+ _id = r.ReadObject<IgniteGuid>();
_localOrder = r.ReadLong();
http://git-wip-us.apache.org/repos/asf/ignite/blob/8e5e3cbf/modules/platforms/dotnet/Apache.Ignite.Core/Events/JobEvent.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Events/JobEvent.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Events/JobEvent.cs
index 06512c5..878562f 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Events/JobEvent.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Events/JobEvent.cs
@@ -54,8 +54,8 @@ namespace Apache.Ignite.Core.Events
{
_taskName = r.ReadString();
_taskClassName = r.ReadString();
- _taskSessionId = IgniteGuid.Read(r);
- _jobId = IgniteGuid.Read(r);
+ _taskSessionId = r.ReadObject<IgniteGuid?>();
+ _jobId = r.ReadObject<IgniteGuid?>();
_taskNode = ReadNode(r);
_taskSubjectId = r.ReadGuid();
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/8e5e3cbf/modules/platforms/dotnet/Apache.Ignite.Core/Events/TaskEvent.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Events/TaskEvent.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Events/TaskEvent.cs
index aa03969..e2b9eaf 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Events/TaskEvent.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Events/TaskEvent.cs
@@ -50,7 +50,7 @@ namespace Apache.Ignite.Core.Events
{
_taskName = r.ReadString();
_taskClassName = r.ReadString();
- _taskSessionId = IgniteGuid.Read(r);
+ _taskSessionId = r.ReadObject<IgniteGuid?>();
_internal = r.ReadBoolean();
_subjectId = r.ReadGuid();
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/8e5e3cbf/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryReader.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryReader.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryReader.cs
index 2a59c06..092eb72 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryReader.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryReader.cs
@@ -354,13 +354,13 @@ namespace Apache.Ignite.Core.Impl.Binary
/** <inheritdoc /> */
public Guid? ReadGuid(string fieldName)
{
- return ReadField(fieldName, BinaryUtils.ReadGuid, BinaryUtils.TypeGuid);
+ return ReadField<Guid?>(fieldName, r => BinaryUtils.ReadGuid(r), BinaryUtils.TypeGuid);
}
/** <inheritdoc /> */
public Guid? ReadGuid()
{
- return Read(BinaryUtils.ReadGuid, BinaryUtils.TypeGuid);
+ return Read<Guid?>(r => BinaryUtils.ReadGuid(r), BinaryUtils.TypeGuid);
}
/** <inheritdoc /> */
http://git-wip-us.apache.org/repos/asf/ignite/blob/8e5e3cbf/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinarySystemHandlers.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinarySystemHandlers.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinarySystemHandlers.cs
index f601a34..beb2668 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinarySystemHandlers.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinarySystemHandlers.cs
@@ -102,7 +102,7 @@ namespace Apache.Ignite.Core.Impl.Binary
ReadHandlers[BinaryUtils.TypeString] = new BinarySystemReader<string>(BinaryUtils.ReadString);
// 4. Guid.
- ReadHandlers[BinaryUtils.TypeGuid] = new BinarySystemReader<Guid?>(BinaryUtils.ReadGuid);
+ ReadHandlers[BinaryUtils.TypeGuid] = new BinarySystemReader<Guid?>(s => BinaryUtils.ReadGuid(s));
// 5. Primitive arrays.
ReadHandlers[BinaryUtils.TypeArrayBool] = new BinarySystemReader<bool[]>(BinaryUtils.ReadBooleanArray);
http://git-wip-us.apache.org/repos/asf/ignite/blob/8e5e3cbf/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryUtils.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryUtils.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryUtils.cs
index 09c3ad4..f00b8f9 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryUtils.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryUtils.cs
@@ -190,6 +190,9 @@ namespace Apache.Ignite.Core.Impl.Binary
/** Type: platform object proxy. */
public const byte TypePlatformJavaObjectFactoryProxy = 99;
+ /** Type: platform object proxy. */
+ public const int TypeIgniteUuid = 2018070327;
+
/** Collection: custom. */
public const byte CollectionCustom = 0;
@@ -254,8 +257,8 @@ namespace Apache.Ignite.Core.Impl.Binary
? (Action<Guid, IBinaryStream>)WriteGuidFast : WriteGuidSlow;
/** Guid reader. */
- public static readonly Func<IBinaryStream, Guid?> ReadGuid = IsGuidSequential
- ? (Func<IBinaryStream, Guid?>)ReadGuidFast : ReadGuidSlow;
+ public static readonly Func<IBinaryStream, Guid> ReadGuid = IsGuidSequential
+ ? (Func<IBinaryStream, Guid>)ReadGuidFast : ReadGuidSlow;
/** String mode environment variable. */
public const string IgniteBinaryMarshallerUseStringSerializationVer2 =
@@ -1169,7 +1172,7 @@ namespace Apache.Ignite.Core.Impl.Binary
/// </summary>
/// <param name="stream">The stream.</param>
/// <returns>Guid.</returns>
- public static unsafe Guid? ReadGuidFast(IBinaryStream stream)
+ public static unsafe Guid ReadGuidFast(IBinaryStream stream)
{
JavaGuid jguid;
@@ -1187,7 +1190,7 @@ namespace Apache.Ignite.Core.Impl.Binary
/// </summary>
/// <param name="stream">The stream.</param>
/// <returns>Guid.</returns>
- public static unsafe Guid? ReadGuidSlow(IBinaryStream stream)
+ public static unsafe Guid ReadGuidSlow(IBinaryStream stream)
{
byte* jBytes = stackalloc byte[16];
http://git-wip-us.apache.org/repos/asf/ignite/blob/8e5e3cbf/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Marshaller.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Marshaller.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Marshaller.cs
index 6dee998..9ec4216 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Marshaller.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Marshaller.cs
@@ -23,6 +23,7 @@ namespace Apache.Ignite.Core.Impl.Binary
using System.Linq;
using Apache.Ignite.Core.Binary;
using Apache.Ignite.Core.Cache.Affinity;
+ using Apache.Ignite.Core.Common;
using Apache.Ignite.Core.Impl.Binary.IO;
using Apache.Ignite.Core.Impl.Binary.Metadata;
using Apache.Ignite.Core.Impl.Cache;
@@ -60,7 +61,7 @@ namespace Apache.Ignite.Core.Impl.Binary
/// <summary>
/// Constructor.
/// </summary>
- /// <param name="cfg">Configurtaion.</param>
+ /// <param name="cfg">Configuration.</param>
public Marshaller(BinaryConfiguration cfg)
{
// Validation.
@@ -609,6 +610,7 @@ namespace Apache.Ignite.Core.Impl.Binary
AddSystemType(0, r => new AffinityKey(r), "affKey");
AddSystemType(BinaryUtils.TypePlatformJavaObjectFactoryProxy, r => new PlatformJavaObjectFactoryProxy());
AddSystemType(0, r => new ObjectInfoHolder(r));
+ AddSystemType(BinaryUtils.TypeIgniteUuid, r => new IgniteGuid(r));
}
}
}
[5/8] ignite git commit: IGNITE-4825 Inject resources from platform
plugins
Posted by sb...@apache.org.
IGNITE-4825 Inject resources from platform plugins
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/4820c458
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/4820c458
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/4820c458
Branch: refs/heads/ignite-4768-1
Commit: 4820c458fde5d641c114b2fda94061abe452a2d0
Parents: 8e5e3cb
Author: Pavel Tupitsyn <pt...@apache.org>
Authored: Wed Mar 15 17:41:41 2017 +0300
Committer: Pavel Tupitsyn <pt...@apache.org>
Committed: Wed Mar 15 17:41:41 2017 +0300
----------------------------------------------------------------------
.../Plugin/PluginTest.cs | 24 ++++++++++++++++++++
.../Impl/Plugin/PluginContext.cs | 9 ++++++++
.../Apache.Ignite.Core/Plugin/IPluginContext.cs | 8 +++++++
3 files changed, 41 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/4820c458/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Plugin/PluginTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Plugin/PluginTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Plugin/PluginTest.cs
index 8256bba..7e766a0 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Plugin/PluginTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Plugin/PluginTest.cs
@@ -25,6 +25,7 @@ namespace Apache.Ignite.Core.Tests.Plugin
using Apache.Ignite.Core.Common;
using Apache.Ignite.Core.Interop;
using Apache.Ignite.Core.Plugin;
+ using Apache.Ignite.Core.Resource;
using NUnit.Framework;
/// <summary>
@@ -67,6 +68,7 @@ namespace Apache.Ignite.Core.Tests.Plugin
Assert.IsNotNull(ctx.Ignite);
Assert.AreEqual(cfg, ctx.IgniteConfiguration);
Assert.AreEqual("barbaz", ctx.PluginConfiguration.PluginProperty);
+ CheckResourceInjection(ctx);
var plugin2 = ignite.GetPlugin<TestIgnitePlugin>(TestIgnitePluginProvider.PluginName);
Assert.AreEqual(plugin, plugin2);
@@ -82,6 +84,21 @@ namespace Apache.Ignite.Core.Tests.Plugin
}
/// <summary>
+ /// Checks the resource injection.
+ /// </summary>
+ private static void CheckResourceInjection(IPluginContext<TestIgnitePluginConfiguration> ctx)
+ {
+ var obj = new Injectee();
+
+ Assert.IsNull(obj.Ignite);
+
+ ctx.InjectResources(obj);
+
+ Assert.IsNotNull(obj.Ignite);
+ Assert.AreEqual(ctx.Ignite.Name, obj.Ignite.Name);
+ }
+
+ /// <summary>
/// Checks the plugin target operations.
/// </summary>
private static void CheckPluginTarget(IPlatformTarget target, string expectedName,
@@ -314,5 +331,12 @@ namespace Apache.Ignite.Core.Tests.Plugin
PluginLog.Add(Name + ".Start");
}
}
+
+ private class Injectee
+ {
+ [InstanceResource]
+ // ReSharper disable once UnusedAutoPropertyAccessor.Local
+ public IIgnite Ignite { get; set; }
+ }
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/4820c458/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Plugin/PluginContext.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Plugin/PluginContext.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Plugin/PluginContext.cs
index fd7033c..cc20cb3 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Plugin/PluginContext.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Plugin/PluginContext.cs
@@ -19,6 +19,7 @@ namespace Apache.Ignite.Core.Impl.Plugin
{
using Apache.Ignite.Core.Common;
using Apache.Ignite.Core.Impl.Common;
+ using Apache.Ignite.Core.Impl.Resource;
using Apache.Ignite.Core.Impl.Unmanaged;
using Apache.Ignite.Core.Interop;
using Apache.Ignite.Core.Plugin;
@@ -87,5 +88,13 @@ namespace Apache.Ignite.Core.Impl.Plugin
_pluginProcessor.RegisterCallback(callbackId, callback);
}
+
+ /** <inheritdoc /> */
+ public void InjectResources(object target)
+ {
+ IgniteArgumentCheck.NotNull(target, "target");
+
+ ResourceProcessor.Inject(target, _pluginProcessor.Ignite);
+ }
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/4820c458/modules/platforms/dotnet/Apache.Ignite.Core/Plugin/IPluginContext.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Plugin/IPluginContext.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Plugin/IPluginContext.cs
index 03d130b..9349611 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Plugin/IPluginContext.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Plugin/IPluginContext.cs
@@ -19,6 +19,7 @@ namespace Apache.Ignite.Core.Plugin
{
using Apache.Ignite.Core.Common;
using Apache.Ignite.Core.Interop;
+ using Apache.Ignite.Core.Resource;
/// <summary>
/// Plugin execution context.
@@ -64,5 +65,12 @@ namespace Apache.Ignite.Core.Plugin
/// <param name="callbackId">Callback id.</param>
/// <param name="callback">Callback delegate.</param>
void RegisterCallback(long callbackId, PluginCallback callback);
+
+ /// <summary>
+ /// Injects resources into specified target:
+ /// populates members marked with <see cref="InstanceResourceAttribute"/>.
+ /// </summary>
+ /// <param name="target">Target object.</param>
+ void InjectResources(object target);
}
}
\ No newline at end of file
[2/8] ignite git commit: IGNITE-3207 Fix .NET
ConsoleRedirectTest.TestMultipleDomains
Posted by sb...@apache.org.
IGNITE-3207 Fix .NET ConsoleRedirectTest.TestMultipleDomains
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/be93baa7
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/be93baa7
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/be93baa7
Branch: refs/heads/ignite-4768-1
Commit: be93baa755447e5eef95e11ba43d4468bf5be31e
Parents: 5db0c02
Author: Pavel Tupitsyn <pt...@apache.org>
Authored: Wed Mar 15 13:32:50 2017 +0300
Committer: Pavel Tupitsyn <pt...@apache.org>
Committed: Wed Mar 15 13:32:50 2017 +0300
----------------------------------------------------------------------
.../dotnet/Apache.Ignite.Core.Tests/ConsoleRedirectTest.cs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/be93baa7/modules/platforms/dotnet/Apache.Ignite.Core.Tests/ConsoleRedirectTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/ConsoleRedirectTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/ConsoleRedirectTest.cs
index bb44dcc..3884cab 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/ConsoleRedirectTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/ConsoleRedirectTest.cs
@@ -118,7 +118,7 @@ namespace Apache.Ignite.Core.Tests
var outTxt = _outSb.ToString();
// Check output from another domain (2 started + 2 stopped = 4)
- Assert.AreEqual(4, Regex.Matches(outTxt, ">>> Grid name: newDomainGrid").Count);
+ Assert.AreEqual(4, Regex.Matches(outTxt, ">>> Ignite instance name: newDomainGrid").Count);
// Both domains produce the topology snapshot on node enter
Assert.AreEqual(2, Regex.Matches(outTxt, "ver=2, servers=2, clients=0,").Count);
[8/8] ignite git commit: ignite-4768 txs
Posted by sb...@apache.org.
ignite-4768 txs
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/e012ca3c
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/e012ca3c
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/e012ca3c
Branch: refs/heads/ignite-4768-1
Commit: e012ca3c54b7859c5ec761e62a1270534d033799
Parents: 4072b9f
Author: sboikov <sb...@gridgain.com>
Authored: Thu Mar 16 10:52:39 2017 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Thu Mar 16 10:52:39 2017 +0300
----------------------------------------------------------------------
.../cache/distributed/IgniteTxCachePrimarySyncTest.java | 5 +++++
1 file changed, 5 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/e012ca3c/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteTxCachePrimarySyncTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteTxCachePrimarySyncTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteTxCachePrimarySyncTest.java
index b0aa67a..3d57354 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteTxCachePrimarySyncTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteTxCachePrimarySyncTest.java
@@ -105,6 +105,11 @@ public class IgniteTxCachePrimarySyncTest extends GridCommonAbstractTest {
}
/** {@inheritDoc} */
+ @Override protected long getTestTimeout() {
+ return 10 * 60_000;
+ }
+
+ /** {@inheritDoc} */
@Override protected void beforeTestsStarted() throws Exception {
super.beforeTestsStarted();
[3/8] ignite git commit: IGNITE-4729 Async operation support in
platform plugins
Posted by sb...@apache.org.
IGNITE-4729 Async operation support in platform plugins
This closes #1561
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/637c18de
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/637c18de
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/637c18de
Branch: refs/heads/ignite-4768-1
Commit: 637c18de190515293e01434862004a410cfadd53
Parents: be93baa
Author: Pavel Tupitsyn <pt...@apache.org>
Authored: Wed Mar 15 14:02:12 2017 +0300
Committer: Pavel Tupitsyn <pt...@apache.org>
Committed: Wed Mar 15 14:02:12 2017 +0300
----------------------------------------------------------------------
.../platform/PlatformAbstractTarget.java | 8 ++
.../platform/PlatformAsyncResult.java | 41 +++++++++
.../processors/platform/PlatformTarget.java | 10 +++
.../platform/PlatformTargetProxy.java | 9 ++
.../platform/PlatformTargetProxyImpl.java | 39 +++++++++
.../plugin/PlatformTestPluginTarget.java | 89 +++++++++++++++++++-
.../cpp/jni/include/ignite/jni/exports.h | 1 +
.../platforms/cpp/jni/include/ignite/jni/java.h | 2 +
modules/platforms/cpp/jni/project/vs/module.def | 1 +
modules/platforms/cpp/jni/src/exports.cpp | 4 +
modules/platforms/cpp/jni/src/java.cpp | 10 +++
.../Plugin/PluginTest.cs | 17 ++++
.../Apache.Ignite.Core/Impl/PlatformTarget.cs | 29 +++++++
.../Impl/Unmanaged/IgniteJniNativeMethods.cs | 3 +
.../Impl/Unmanaged/UnmanagedUtils.cs | 5 ++
.../Interop/IPlatformTarget.cs | 13 +++
16 files changed, 277 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/637c18de/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformAbstractTarget.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformAbstractTarget.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformAbstractTarget.java
index 506470b..396e784 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformAbstractTarget.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformAbstractTarget.java
@@ -125,6 +125,14 @@ public abstract class PlatformAbstractTarget implements PlatformTarget, Platform
return throwUnsupported(type);
}
+ /** {@inheritDoc} */
+ @Override public PlatformAsyncResult processInStreamAsync(int type, BinaryRawReaderEx reader)
+ throws IgniteCheckedException {
+ throwUnsupported(type);
+
+ return null;
+ }
+
/**
* Throw an exception rendering unsupported operation type.
*
http://git-wip-us.apache.org/repos/asf/ignite/blob/637c18de/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformAsyncResult.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformAsyncResult.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformAsyncResult.java
new file mode 100644
index 0000000..879f85d
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformAsyncResult.java
@@ -0,0 +1,41 @@
+/*
+ * 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.internal.processors.platform;
+
+import org.apache.ignite.internal.binary.BinaryRawWriterEx;
+import org.apache.ignite.lang.IgniteFuture;
+
+/**
+ * Represents asynchronous operation result.
+ */
+public interface PlatformAsyncResult {
+ /**
+ * Async operation future.
+ *
+ * @return Future.
+ */
+ IgniteFuture future();
+
+ /**
+ * Async operation result writer method.
+ *
+ * @param writer Writer.
+ * @param result Async operation result.
+ */
+ void write(BinaryRawWriterEx writer, Object result);
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/637c18de/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformTarget.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformTarget.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformTarget.java
index 5d234dd..9792df8 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformTarget.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformTarget.java
@@ -108,6 +108,16 @@ public interface PlatformTarget {
PlatformTarget processOutObject(int type) throws IgniteCheckedException;
/**
+ * Process asynchronous operation.
+ *
+ * @param type Type.
+ * @param reader Binary reader.
+ * @return Async result (should not be null).
+ * @throws IgniteCheckedException In case of exception.
+ */
+ PlatformAsyncResult processInStreamAsync(int type, BinaryRawReaderEx reader) throws IgniteCheckedException;
+
+ /**
* Convert caught exception.
*
* @param e Exception to convert.
http://git-wip-us.apache.org/repos/asf/ignite/blob/637c18de/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformTargetProxy.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformTargetProxy.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformTargetProxy.java
index a4f2a56..c2a0797 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformTargetProxy.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformTargetProxy.java
@@ -97,6 +97,15 @@ public interface PlatformTargetProxy {
Object outObject(int type) throws Exception;
/**
+ * Asynchronous operation accepting memory stream.
+ *
+ * @param type Operation type.
+ * @param memPtr Memory pointer.
+ * @throws Exception If case of failure.
+ */
+ void inStreamAsync(int type, long memPtr) throws Exception;
+
+ /**
* Start listening for the future.
*
* @param futId Future ID.
http://git-wip-us.apache.org/repos/asf/ignite/blob/637c18de/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformTargetProxyImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformTargetProxyImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformTargetProxyImpl.java
index 25a4de8..7e0036d 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformTargetProxyImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformTargetProxyImpl.java
@@ -18,12 +18,14 @@
package org.apache.ignite.internal.processors.platform;
import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.IgniteException;
import org.apache.ignite.internal.IgniteInternalFuture;
import org.apache.ignite.internal.binary.BinaryRawReaderEx;
import org.apache.ignite.internal.binary.BinaryRawWriterEx;
import org.apache.ignite.internal.processors.platform.memory.PlatformMemory;
import org.apache.ignite.internal.processors.platform.memory.PlatformOutputStream;
import org.apache.ignite.internal.processors.platform.utils.PlatformFutureUtils;
+import org.apache.ignite.lang.IgniteFuture;
/**
* Platform target that is invoked via JNI and propagates calls to underlying {@link PlatformTarget}.
@@ -104,6 +106,43 @@ public class PlatformTargetProxyImpl implements PlatformTargetProxy {
}
/** {@inheritDoc} */
+ @Override public void inStreamAsync(int type, long memPtr) throws Exception {
+ try (PlatformMemory mem = platformCtx.memory().get(memPtr)) {
+ BinaryRawReaderEx reader = platformCtx.reader(mem);
+
+ long futId = reader.readLong();
+ int futTyp = reader.readInt();
+
+ final PlatformAsyncResult res = target.processInStreamAsync(type, reader);
+
+ if (res == null) {
+ throw new IgniteException("PlatformTarget.processInStreamAsync should not return null.");
+ }
+
+ IgniteFuture fut = res.future();
+
+ if (fut == null) {
+ throw new IgniteException("PlatformAsyncResult.future() should not return null.");
+ }
+
+ PlatformFutureUtils.listen(platformCtx, fut, futId, futTyp, new PlatformFutureUtils.Writer() {
+ /** {@inheritDoc} */
+ @Override public void write(BinaryRawWriterEx writer, Object obj, Throwable err) {
+ res.write(writer, obj);
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean canWrite(Object obj, Throwable err) {
+ return err == null;
+ }
+ }, target);
+ }
+ catch (Exception e) {
+ throw target.convertException(e);
+ }
+ }
+
+ /** {@inheritDoc} */
@Override public void inStreamOutStream(int type, long inMemPtr, long outMemPtr) throws Exception {
try (PlatformMemory inMem = platformCtx.memory().get(inMemPtr)) {
BinaryRawReaderEx reader = platformCtx.reader(inMem);
http://git-wip-us.apache.org/repos/asf/ignite/blob/637c18de/modules/core/src/test/java/org/apache/ignite/platform/plugin/PlatformTestPluginTarget.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/platform/plugin/PlatformTestPluginTarget.java b/modules/core/src/test/java/org/apache/ignite/platform/plugin/PlatformTestPluginTarget.java
index e80a23f..7e69425 100644
--- a/modules/core/src/test/java/org/apache/ignite/platform/plugin/PlatformTestPluginTarget.java
+++ b/modules/core/src/test/java/org/apache/ignite/platform/plugin/PlatformTestPluginTarget.java
@@ -21,11 +21,14 @@ import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.internal.binary.BinaryRawReaderEx;
import org.apache.ignite.internal.binary.BinaryRawWriterEx;
-import org.apache.ignite.internal.processors.platform.PlatformAbstractTarget;
+import org.apache.ignite.internal.processors.platform.PlatformAsyncResult;
import org.apache.ignite.internal.processors.platform.PlatformContext;
import org.apache.ignite.internal.processors.platform.PlatformTarget;
import org.apache.ignite.internal.processors.platform.memory.PlatformMemory;
import org.apache.ignite.internal.processors.platform.memory.PlatformOutputStream;
+import org.apache.ignite.internal.util.future.GridFutureAdapter;
+import org.apache.ignite.internal.util.future.IgniteFutureImpl;
+import org.apache.ignite.lang.IgniteFuture;
import org.apache.ignite.plugin.PluginConfiguration;
import org.jetbrains.annotations.Nullable;
@@ -33,17 +36,20 @@ import org.jetbrains.annotations.Nullable;
* Test target.
*/
@SuppressWarnings("ConstantConditions")
-class PlatformTestPluginTarget extends PlatformAbstractTarget {
+class PlatformTestPluginTarget implements PlatformTarget {
/** */
private final String name;
+ /** */
+ private final PlatformContext platformCtx;
+
/**
* Constructor.
*
* @param platformCtx Context.
*/
PlatformTestPluginTarget(PlatformContext platformCtx, String name) {
- super(platformCtx);
+ this.platformCtx = platformCtx;
if (name == null) {
// Initialize from configuration.
@@ -65,12 +71,17 @@ class PlatformTestPluginTarget extends PlatformAbstractTarget {
return val + 1;
}
- /** {@inheritDoc} */
@Override public long processInStreamOutLong(int type, BinaryRawReaderEx reader) throws IgniteCheckedException {
return reader.readString().length();
}
/** {@inheritDoc} */
+ @Override public long processInStreamOutLong(int type, BinaryRawReaderEx reader, PlatformMemory mem)
+ throws IgniteCheckedException {
+ return processInStreamOutLong(type, reader);
+ }
+
+ /** {@inheritDoc} */
@Override public void processInStreamOutStream(int type, BinaryRawReaderEx reader, BinaryRawWriterEx writer)
throws IgniteCheckedException {
String s = reader.readString();
@@ -129,6 +140,76 @@ class PlatformTestPluginTarget extends PlatformAbstractTarget {
return new PlatformTestPluginTarget(platformCtx, name);
}
+ /** {@inheritDoc} */
+ @Override public PlatformAsyncResult processInStreamAsync(int type, BinaryRawReaderEx reader) throws IgniteCheckedException {
+ switch (type) {
+ case 1: {
+ // Async upper case.
+ final String val = reader.readString();
+ final GridFutureAdapter<String> fa = new GridFutureAdapter<>();
+
+ new Thread(new Runnable() {
+ @Override public void run() {
+ try {
+ Thread.sleep(500L);
+ fa.onDone(val.toUpperCase());
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+ }).start();
+
+ return new PlatformAsyncResult() {
+ @Override public IgniteFuture future() {
+ //noinspection unchecked
+ return new IgniteFutureImpl(fa);
+ }
+
+ @Override public void write(BinaryRawWriterEx writer, Object result) {
+ writer.writeString((String) result);
+ }
+ };
+ }
+ case 2: {
+ // Exception.
+ throw new PlatformTestPluginException("123");
+ }
+ case 3: {
+ // Async exception.
+ final GridFutureAdapter<String> fa = new GridFutureAdapter<>();
+
+ new Thread(new Runnable() {
+ @Override public void run() {
+ try {
+ Thread.sleep(500L);
+ fa.onDone(new PlatformTestPluginException("x"));
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+ }).start();
+
+ return new PlatformAsyncResult() {
+ @Override public IgniteFuture future() {
+ //noinspection unchecked
+ return new IgniteFutureImpl(fa);
+ }
+
+ @Override public void write(BinaryRawWriterEx writer, Object result) {
+ // No-op.
+ }
+ };
+ }
+ }
+
+ return null;
+ }
+
+ /** {@inheritDoc} */
+ @Override public Exception convertException(Exception e) {
+ return e;
+ }
+
/**
* Gets the plugin config.
*
http://git-wip-us.apache.org/repos/asf/ignite/blob/637c18de/modules/platforms/cpp/jni/include/ignite/jni/exports.h
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/jni/include/ignite/jni/exports.h b/modules/platforms/cpp/jni/include/ignite/jni/exports.h
index a93f580..06be75d 100644
--- a/modules/platforms/cpp/jni/include/ignite/jni/exports.h
+++ b/modules/platforms/cpp/jni/include/ignite/jni/exports.h
@@ -66,6 +66,7 @@ extern "C" {
void* IGNITE_CALL IgniteTargetInObjectStreamOutObjectStream(gcj::JniContext* ctx, void* obj, int opType, void* arg, long long inMemPtr, long long outMemPtr);
void IGNITE_CALL IgniteTargetOutStream(gcj::JniContext* ctx, void* obj, int opType, long long memPtr);
void* IGNITE_CALL IgniteTargetOutObject(gcj::JniContext* ctx, void* obj, int opType);
+ void IGNITE_CALL IgniteTargetInStreamAsync(gcj::JniContext* ctx, void* obj, int opType, long long memPtr);
void IGNITE_CALL IgniteTargetListenFuture(gcj::JniContext* ctx, void* obj, long long futId, int typ);
void IGNITE_CALL IgniteTargetListenFutureForOperation(gcj::JniContext* ctx, void* obj, long long futId, int typ, int opId);
http://git-wip-us.apache.org/repos/asf/ignite/blob/637c18de/modules/platforms/cpp/jni/include/ignite/jni/java.h
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/jni/include/ignite/jni/java.h b/modules/platforms/cpp/jni/include/ignite/jni/java.h
index a07b844..7c5d684 100644
--- a/modules/platforms/cpp/jni/include/ignite/jni/java.h
+++ b/modules/platforms/cpp/jni/include/ignite/jni/java.h
@@ -208,6 +208,7 @@ namespace ignite
jmethodID m_PlatformTarget_inStreamOutObject;
jmethodID m_PlatformTarget_outStream;
jmethodID m_PlatformTarget_outObject;
+ jmethodID m_PlatformTarget_inStreamAsync;
jmethodID m_PlatformTarget_inStreamOutStream;
jmethodID m_PlatformTarget_inObjectStreamOutObjectStream;
jmethodID m_PlatformTarget_listenFuture;
@@ -387,6 +388,7 @@ namespace ignite
jobject TargetInObjectStreamOutObjectStream(jobject obj, int opType, void* arg, long long inMemPtr, long long outMemPtr, JniErrorInfo* errInfo = NULL);
void TargetOutStream(jobject obj, int opType, long long memPtr, JniErrorInfo* errInfo = NULL);
jobject TargetOutObject(jobject obj, int opType, JniErrorInfo* errInfo = NULL);
+ void TargetInStreamAsync(jobject obj, int type, long long memPtr, JniErrorInfo* errInfo = NULL);
void TargetListenFuture(jobject obj, long long futId, int typ);
void TargetListenFutureForOperation(jobject obj, long long futId, int typ, int opId);
http://git-wip-us.apache.org/repos/asf/ignite/blob/637c18de/modules/platforms/cpp/jni/project/vs/module.def
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/jni/project/vs/module.def b/modules/platforms/cpp/jni/project/vs/module.def
index 45a5bff..8159f8d 100644
--- a/modules/platforms/cpp/jni/project/vs/module.def
+++ b/modules/platforms/cpp/jni/project/vs/module.def
@@ -23,6 +23,7 @@ IgniteTargetInObjectStreamOutObjectStream @21
IgniteTargetListenFuture @22
IgniteTargetListenFutureForOperation @23
IgniteTargetInLongOutLong @24
+IgniteTargetInStreamAsync @25
IgniteProcessorCompute @64
IgniteProcessorMessage @65
IgniteProcessorEvents @66
http://git-wip-us.apache.org/repos/asf/ignite/blob/637c18de/modules/platforms/cpp/jni/src/exports.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/jni/src/exports.cpp b/modules/platforms/cpp/jni/src/exports.cpp
index 17fed71..6c590e4 100644
--- a/modules/platforms/cpp/jni/src/exports.cpp
+++ b/modules/platforms/cpp/jni/src/exports.cpp
@@ -182,6 +182,10 @@ extern "C" {
return ctx->TargetOutObject(static_cast<jobject>(obj), opType);
}
+ void IGNITE_CALL IgniteTargetInStreamAsync(gcj::JniContext* ctx, void* obj, int opType, long long memPtr) {
+ ctx->TargetInStreamAsync(static_cast<jobject>(obj), opType, memPtr);
+ }
+
void IGNITE_CALL IgniteTargetListenFuture(gcj::JniContext* ctx, void* obj, long long futId, int typ) {
ctx->TargetListenFuture(static_cast<jobject>(obj), futId, typ);
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/637c18de/modules/platforms/cpp/jni/src/java.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/jni/src/java.cpp b/modules/platforms/cpp/jni/src/java.cpp
index 1988a86..004a99c 100644
--- a/modules/platforms/cpp/jni/src/java.cpp
+++ b/modules/platforms/cpp/jni/src/java.cpp
@@ -258,6 +258,7 @@ namespace ignite
JniMethod M_PLATFORM_TARGET_IN_OBJECT_STREAM_OUT_OBJECT_STREAM = JniMethod("inObjectStreamOutObjectStream", "(ILjava/lang/Object;JJ)Ljava/lang/Object;", false);
JniMethod M_PLATFORM_TARGET_OUT_STREAM = JniMethod("outStream", "(IJ)V", false);
JniMethod M_PLATFORM_TARGET_OUT_OBJECT = JniMethod("outObject", "(I)Ljava/lang/Object;", false);
+ JniMethod M_PLATFORM_TARGET_IN_STREAM_ASYNC = JniMethod("inStreamAsync", "(IJ)V", false);
JniMethod M_PLATFORM_TARGET_LISTEN_FUTURE = JniMethod("listenFuture", "(JI)V", false);
JniMethod M_PLATFORM_TARGET_LISTEN_FOR_OPERATION = JniMethod("listenFutureForOperation", "(JII)V", false);
@@ -590,6 +591,7 @@ namespace ignite
m_PlatformTarget_outObject = FindMethod(env, c_PlatformTarget, M_PLATFORM_TARGET_OUT_OBJECT);
m_PlatformTarget_inStreamOutStream = FindMethod(env, c_PlatformTarget, M_PLATFORM_TARGET_IN_STREAM_OUT_STREAM);
m_PlatformTarget_inObjectStreamOutObjectStream = FindMethod(env, c_PlatformTarget, M_PLATFORM_TARGET_IN_OBJECT_STREAM_OUT_OBJECT_STREAM);
+ m_PlatformTarget_inStreamAsync = FindMethod(env, c_PlatformTarget, M_PLATFORM_TARGET_IN_STREAM_ASYNC);
m_PlatformTarget_listenFuture = FindMethod(env, c_PlatformTarget, M_PLATFORM_TARGET_LISTEN_FUTURE);
m_PlatformTarget_listenFutureForOperation = FindMethod(env, c_PlatformTarget, M_PLATFORM_TARGET_LISTEN_FOR_OPERATION);
@@ -1386,6 +1388,14 @@ namespace ignite
return LocalToGlobal(env, res);
}
+ void JniContext::TargetInStreamAsync(jobject obj, int opType, long long memPtr, JniErrorInfo* err) {
+ JNIEnv* env = Attach();
+
+ env->CallVoidMethod(obj, jvm->GetMembers().m_PlatformTarget_inStreamAsync, opType, memPtr);
+
+ ExceptionCheck(env, err);
+ }
+
void JniContext::TargetListenFuture(jobject obj, long long futId, int typ) {
JNIEnv* env = Attach();
http://git-wip-us.apache.org/repos/asf/ignite/blob/637c18de/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Plugin/PluginTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Plugin/PluginTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Plugin/PluginTest.cs
index b6c00b5..8256bba 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Plugin/PluginTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Plugin/PluginTest.cs
@@ -20,6 +20,7 @@ namespace Apache.Ignite.Core.Tests.Plugin
using System;
using System.Collections.Generic;
using System.IO;
+ using System.Linq;
using Apache.Ignite.Core.Binary;
using Apache.Ignite.Core.Common;
using Apache.Ignite.Core.Interop;
@@ -117,6 +118,22 @@ namespace Apache.Ignite.Core.Tests.Plugin
var resCopy = res.Item2.OutObject(1);
Assert.AreEqual("name1_abc", resCopy.OutStream(1, r => r.ReadString()));
+ // Async operation.
+ var task = target.DoOutOpAsync(1, w => w.WriteString("foo"), r => r.ReadString());
+ Assert.IsFalse(task.IsCompleted);
+ var asyncRes = task.Result;
+ Assert.IsTrue(task.IsCompleted);
+ Assert.AreEqual("FOO", asyncRes);
+
+ // Async operation with exception in entry point.
+ Assert.Throws<TestIgnitePluginException>(() => target.DoOutOpAsync<object>(2, null, null));
+
+ // Async operation with exception in future.
+ var errTask = target.DoOutOpAsync<object>(3, null, null);
+ Assert.IsFalse(errTask.IsCompleted);
+ var aex = Assert.Throws<AggregateException>(() => errTask.Wait());
+ Assert.IsInstanceOf<IgniteException>(aex.InnerExceptions.Single());
+
// Throws custom mapped exception.
var ex = Assert.Throws<TestIgnitePluginException>(() => target.InLongOutLong(-1, 0));
Assert.AreEqual("Baz", ex.Message);
http://git-wip-us.apache.org/repos/asf/ignite/blob/637c18de/modules/platforms/dotnet/Apache.Ignite.Core/Impl/PlatformTarget.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/PlatformTarget.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/PlatformTarget.cs
index f115042..621bfa5 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/PlatformTarget.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/PlatformTarget.cs
@@ -962,6 +962,35 @@ namespace Apache.Ignite.Core.Impl
return GetPlatformTarget(DoOutOpObject(type));
}
+ /** <inheritdoc /> */
+ public Task<T> DoOutOpAsync<T>(int type, Action<IBinaryRawWriter> writeAction = null,
+ Func<IBinaryRawReader, T> readAction = null)
+ {
+ var convertFunc = readAction != null
+ ? r => readAction(r)
+ : (Func<BinaryReader, T>) null;
+
+ return GetFuture((futId, futType) =>
+ {
+ using (var stream = IgniteManager.Memory.Allocate().GetStream())
+ {
+ stream.WriteLong(futId);
+ stream.WriteInt(futType);
+
+ if (writeAction != null)
+ {
+ var writer = _marsh.StartMarshal(stream);
+
+ writeAction(writer);
+
+ FinishMarshal(writer);
+ }
+
+ UU.TargetInStreamAsync(_target, type, stream.SynchronizeOutput());
+ }
+ }, false, convertFunc).Task;
+ }
+
/// <summary>
/// Gets the platform target.
/// </summary>
http://git-wip-us.apache.org/repos/asf/ignite/blob/637c18de/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Unmanaged/IgniteJniNativeMethods.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Unmanaged/IgniteJniNativeMethods.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Unmanaged/IgniteJniNativeMethods.cs
index a6a3a31..289589f 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Unmanaged/IgniteJniNativeMethods.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Unmanaged/IgniteJniNativeMethods.cs
@@ -149,6 +149,9 @@ namespace Apache.Ignite.Core.Impl.Unmanaged
[DllImport(IgniteUtils.FileIgniteJniDll, EntryPoint = "IgniteTargetOutObject")]
public static extern void* TargetOutObject(void* ctx, void* target, int opType);
+ [DllImport(IgniteUtils.FileIgniteJniDll, EntryPoint = "IgniteTargetInStreamAsync")]
+ public static extern void TargetInStreamAsync(void* ctx, void* target, int opType, long memPtr);
+
[DllImport(IgniteUtils.FileIgniteJniDll, EntryPoint = "IgniteAcquire")]
public static extern void* Acquire(void* ctx, void* target);
http://git-wip-us.apache.org/repos/asf/ignite/blob/637c18de/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Unmanaged/UnmanagedUtils.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Unmanaged/UnmanagedUtils.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Unmanaged/UnmanagedUtils.cs
index 90e5230..986972f 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Unmanaged/UnmanagedUtils.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Unmanaged/UnmanagedUtils.cs
@@ -464,6 +464,11 @@ namespace Apache.Ignite.Core.Impl.Unmanaged
return target.ChangeTarget(res);
}
+ internal static void TargetInStreamAsync(IUnmanagedTarget target, int opType, long memPtr)
+ {
+ JNI.TargetInStreamAsync(target.Context, target.Target, opType, memPtr);
+ }
+
#endregion
#region NATIVE METHODS: MISCELANNEOUS
http://git-wip-us.apache.org/repos/asf/ignite/blob/637c18de/modules/platforms/dotnet/Apache.Ignite.Core/Interop/IPlatformTarget.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Interop/IPlatformTarget.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Interop/IPlatformTarget.cs
index 8b8963f..e8f8bfb 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Interop/IPlatformTarget.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Interop/IPlatformTarget.cs
@@ -18,7 +18,9 @@
namespace Apache.Ignite.Core.Interop
{
using System;
+ using System.Threading.Tasks;
using Apache.Ignite.Core.Binary;
+ using Apache.Ignite.Core.Impl.Binary;
/// <summary>
/// Interface to interoperate with
@@ -87,5 +89,16 @@ namespace Apache.Ignite.Core.Interop
/// <param name="type">Operation type code.</param>
/// <returns>Result.</returns>
IPlatformTarget OutObject(int type);
+
+ /// <summary>
+ /// Performs asynchronous operation.
+ /// </summary>
+ /// <typeparam name="T">Result type</typeparam>
+ /// <param name="type">Operation type code.</param>
+ /// <param name="writeAction">Write action (can be null).</param>
+ /// <param name="readAction">Read function (can be null).</param>
+ /// <returns>Task.</returns>
+ Task<T> DoOutOpAsync<T>(int type, Action<IBinaryRawWriter> writeAction,
+ Func<IBinaryRawReader, T> readAction);
}
}
[6/8] ignite git commit: ignite-4768 txs
Posted by sb...@apache.org.
ignite-4768 txs
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/bbec344e
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/bbec344e
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/bbec344e
Branch: refs/heads/ignite-4768-1
Commit: bbec344ec21461411634277b0714a470125458f6
Parents: 3df67c6
Author: sboikov <sb...@gridgain.com>
Authored: Thu Mar 16 10:25:13 2017 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Thu Mar 16 10:25:13 2017 +0300
----------------------------------------------------------------------
.../apache/ignite/testsuites/IgniteCacheRestartTestSuite2.java | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/bbec344e/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheRestartTestSuite2.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheRestartTestSuite2.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheRestartTestSuite2.java
index 0513786..1901283 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheRestartTestSuite2.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheRestartTestSuite2.java
@@ -44,7 +44,8 @@ public class IgniteCacheRestartTestSuite2 extends TestSuite {
suite.addTestSuite(IgniteCachePutAllRestartTest.class);
suite.addTestSuite(GridCachePutAllFailoverSelfTest.class);
- suite.addTestSuite(IgniteBinaryMetadataUpdateNodeRestartTest.class);
+ // TODO IGNITE-4768.
+ //suite.addTestSuite(IgniteBinaryMetadataUpdateNodeRestartTest.class);
suite.addTestSuite(IgniteCacheGetRestartTest.class);