From 7290d88e14a15a3d030b7381dbd0a3f14cb65a12 Mon Sep 17 00:00:00 2001 From: Pavel Tupitsyn Date: Tue, 18 Oct 2016 17:17:17 +0300 Subject: [PATCH] IGNITE-4030 Streamline PlatformTarget operation methods This closes #1167 --- .../platform/PlatformAbstractTarget.java | 54 ------------------- .../processors/platform/PlatformTarget.java | 20 ------- .../platform/cache/PlatformCache.java | 27 ++++------ .../cache/affinity/PlatformAffinity.java | 4 +- .../query/PlatformAbstractQueryCursor.java | 4 +- .../query/PlatformContinuousQueryProxy.java | 3 +- .../cluster/PlatformClusterGroup.java | 4 +- .../platform/compute/PlatformCompute.java | 9 +--- .../datastreamer/PlatformDataStreamer.java | 9 +--- .../datastructures/PlatformAtomicLong.java | 27 ++++------ .../PlatformAtomicReference.java | 8 ++- .../PlatformAtomicSequence.java | 31 +++++------ .../platform/services/PlatformServices.java | 13 +++-- .../transactions/PlatformTransactions.java | 17 ++---- .../core/src/impl/cache/query/query_impl.cpp | 6 +-- .../core/src/impl/interop/interop_target.cpp | 2 +- .../cpp/jni/include/ignite/jni/exports.h | 2 - .../cpp/jni/include/ignite/jni/java.h | 4 -- .../platforms/cpp/jni/project/vs/module.def | 3 +- modules/platforms/cpp/jni/src/exports.cpp | 8 --- modules/platforms/cpp/jni/src/java.cpp | 23 -------- .../Impl/Cache/CacheAffinityImpl.cs | 2 +- .../Impl/Cache/CacheImpl.cs | 14 ++--- .../Impl/Cache/Query/AbstractQueryCursor.cs | 4 +- .../Continuous/ContinuousQueryHandleImpl.cs | 2 +- .../Impl/Compute/ComputeImpl.cs | 4 +- .../Impl/DataStructures/AtomicLong.cs | 14 ++--- .../Impl/DataStructures/AtomicReference.cs | 4 +- .../Impl/DataStructures/AtomicSequence.cs | 14 ++--- .../Impl/Datastream/DataStreamerImpl.cs | 20 +++---- .../Apache.Ignite.Core/Impl/Events/Events.cs | 4 +- .../dotnet/Apache.Ignite.Core/Impl/Ignite.cs | 2 +- .../Apache.Ignite.Core/Impl/PlatformTarget.cs | 41 +------------- .../Impl/Services/Services.cs | 4 +- .../Impl/Transactions/TransactionsImpl.cs | 12 ++--- .../Impl/Unmanaged/IgniteJniNativeMethods.cs | 9 +--- .../Impl/Unmanaged/UnmanagedUtils.cs | 12 +---- 37 files changed, 114 insertions(+), 326 deletions(-) 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 22adef88182ca..09092c226fea0 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 @@ -98,16 +98,6 @@ protected PlatformAbstractTarget(PlatformContext platformCtx) { } } - /** {@inheritDoc} */ - @Override public long outLong(int type) throws Exception { - try { - return processOutLong(type); - } - catch (Exception e) { - throw convertException(e); - } - } - /** {@inheritDoc} */ @Override public void outStream(int type, long memPtr) throws Exception { try (PlatformMemory mem = platformCtx.memory().get(memPtr)) { @@ -154,26 +144,6 @@ protected PlatformAbstractTarget(PlatformContext platformCtx) { } } - /** {@inheritDoc} */ - @Override public void inObjectStreamOutStream(int type, Object arg, long inMemPtr, long outMemPtr) throws Exception { - try (PlatformMemory inMem = platformCtx.memory().get(inMemPtr)) { - BinaryRawReaderEx reader = platformCtx.reader(inMem); - - try (PlatformMemory outMem = platformCtx.memory().get(outMemPtr)) { - PlatformOutputStream out = outMem.output(); - - BinaryRawWriterEx writer = platformCtx.writer(out); - - processInObjectStreamOutStream(type, arg, reader, writer); - - out.synchronize(); - } - } - catch (Exception e) { - throw convertException(e); - } - } - /** {@inheritDoc} */ @Override public Object inObjectStreamOutObjectStream(int type, Object arg, long inMemPtr, long outMemPtr) throws Exception { @@ -329,20 +299,6 @@ protected Object processInStreamOutObject(int type, BinaryRawReaderEx reader) th return throwUnsupported(type); } - /** - * Process IN-OUT operation. - * - * @param type Type. - * @param arg Argument. - * @param reader Binary reader. - * @param writer Binary writer. - * @throws IgniteCheckedException In case of exception. - */ - protected void processInObjectStreamOutStream(int type, @Nullable Object arg, BinaryRawReaderEx reader, - BinaryRawWriterEx writer) throws IgniteCheckedException { - throwUnsupported(type); - } - /** * Process IN-OUT operation. * @@ -357,16 +313,6 @@ protected Object processInObjectStreamOutObjectStream(int type, @Nullable Object return throwUnsupported(type); } - /** - * Process OUT operation. - * - * @param type Type. - * @throws IgniteCheckedException In case of exception. - */ - protected long processOutLong(int type) throws IgniteCheckedException { - return throwUnsupported(type); - } - /** * Process OUT operation. * 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 40773d0b09bcd..cde64024ef2a7 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 @@ -66,17 +66,6 @@ public interface PlatformTarget { */ public void inStreamOutStream(int type, long inMemPtr, long outMemPtr) throws Exception; - /** - * Operation accepting an object and a memory stream and returning result to another memory stream. - * - * @param type Operation type. - * @param arg Argument (optional). - * @param inMemPtr Input memory pointer. - * @param outMemPtr Output memory pointer. - * @throws Exception In case of failure. - */ - public void inObjectStreamOutStream(int type, @Nullable Object arg, long inMemPtr, long outMemPtr) throws Exception; - /** * Operation accepting an object and a memory stream and returning result to another memory stream and an object. * @@ -90,15 +79,6 @@ public interface PlatformTarget { public Object inObjectStreamOutObjectStream(int type, @Nullable Object arg, long inMemPtr, long outMemPtr) throws Exception; - /** - * Operation returning long result. - * - * @param type Operation type. - * @return Result. - * @throws Exception In case of failure. - */ - public long outLong(int type) throws Exception; - /** * Operation returning result to memory stream. * diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cache/PlatformCache.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cache/PlatformCache.java index 05945e0f93af8..7986286b2a7cb 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cache/PlatformCache.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cache/PlatformCache.java @@ -273,23 +273,6 @@ public PlatformCache(PlatformContext platformCtx, IgniteCache cache, boolean kee this.keepBinary = keepBinary; } - /** {@inheritDoc} */ - @Override protected long processOutLong(int type) throws IgniteCheckedException { - switch (type) { - case OP_CLEAR_CACHE: - cache.clear(); - - return TRUE; - - case OP_REMOVE_ALL2: - cache.removeAll(); - - return TRUE; - } - - return super.processOutLong(type); - } - /** {@inheritDoc} */ @Override protected long processInStreamOutLong(int type, BinaryRawReaderEx reader) throws IgniteCheckedException { switch (type) { @@ -785,6 +768,16 @@ private void loadCache0(BinaryRawReaderEx reader, boolean loc) { return TRUE; } + + case OP_CLEAR_CACHE: + cache.clear(); + + return TRUE; + + case OP_REMOVE_ALL2: + cache.removeAll(); + + return TRUE; } return super.processInLongOutLong(type, val); } diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cache/affinity/PlatformAffinity.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cache/affinity/PlatformAffinity.java index 41b58aaaf2c19..12df18890889e 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cache/affinity/PlatformAffinity.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cache/affinity/PlatformAffinity.java @@ -292,10 +292,10 @@ public PlatformAffinity(PlatformContext platformCtx, GridKernalContext igniteCtx } /** {@inheritDoc} */ - @Override public long outLong(int type) throws Exception { + @Override public long processInLongOutLong(int type, long val) throws IgniteCheckedException { if (type == OP_PARTITIONS) return aff.partitions(); - return super.outLong(type); + return super.processInLongOutLong(type, val); } } diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cache/query/PlatformAbstractQueryCursor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cache/query/PlatformAbstractQueryCursor.java index ff28b818066b9..6a259caa63e83 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cache/query/PlatformAbstractQueryCursor.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cache/query/PlatformAbstractQueryCursor.java @@ -136,7 +136,7 @@ public PlatformAbstractQueryCursor(PlatformContext platformCtx, QueryCursorEx } /** {@inheritDoc} */ - @Override protected long processOutLong(int type) throws IgniteCheckedException { + @Override protected long processInLongOutLong(int type, long val) throws IgniteCheckedException { switch (type) { case OP_ITERATOR: iter = cursor.iterator(); @@ -154,7 +154,7 @@ public PlatformAbstractQueryCursor(PlatformContext platformCtx, QueryCursorEx return iter.hasNext() ? TRUE : FALSE; } - return super.processOutLong(type); + return super.processInLongOutLong(type, val); } /** {@inheritDoc} */ diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cache/query/PlatformContinuousQueryProxy.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cache/query/PlatformContinuousQueryProxy.java index a4d7cad5abb39..04f17ff2804c1 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cache/query/PlatformContinuousQueryProxy.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cache/query/PlatformContinuousQueryProxy.java @@ -17,6 +17,7 @@ package org.apache.ignite.internal.processors.platform.cache.query; +import org.apache.ignite.IgniteCheckedException; import org.apache.ignite.internal.processors.platform.PlatformAbstractTarget; import org.apache.ignite.internal.processors.platform.PlatformContext; @@ -45,7 +46,7 @@ public PlatformContinuousQueryProxy(PlatformContext platformCtx, PlatformContinu } /** {@inheritDoc} */ - @Override public long outLong(int type) throws Exception { + @Override public long processInLongOutLong(int type, long val) throws IgniteCheckedException { qry.close(); return 0; diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cluster/PlatformClusterGroup.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cluster/PlatformClusterGroup.java index a94e04542516e..957eaaf74b2c9 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cluster/PlatformClusterGroup.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cluster/PlatformClusterGroup.java @@ -322,7 +322,7 @@ public PlatformClusterGroup(PlatformContext platformCtx, ClusterGroupEx prj) { } /** {@inheritDoc} */ - @Override protected long processOutLong(int type) throws IgniteCheckedException { + @Override protected long processInLongOutLong(int type, long val) throws IgniteCheckedException { switch (type) { case OP_RESET_METRICS: { assert prj instanceof IgniteCluster; // Can only be invoked on top-level cluster group. @@ -333,7 +333,7 @@ public PlatformClusterGroup(PlatformContext platformCtx, ClusterGroupEx prj) { } } - return super.processOutLong(type); + return super.processInLongOutLong(type, val); } /** diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/compute/PlatformCompute.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/compute/PlatformCompute.java index 36d709a3f1356..32e484802dc68 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/compute/PlatformCompute.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/compute/PlatformCompute.java @@ -135,14 +135,7 @@ public PlatformCompute(PlatformContext platformCtx, ClusterGroup grp, String pla return TRUE; } - } - - return super.processInLongOutLong(type, val); - } - /** {@inheritDoc} */ - @Override protected long processOutLong(int type) throws IgniteCheckedException { - switch (type) { case OP_WITH_NO_FAILOVER: { compute.withNoFailover(); computeForPlatform.withNoFailover(); @@ -151,7 +144,7 @@ public PlatformCompute(PlatformContext platformCtx, ClusterGroup grp, String pla } } - return super.processOutLong(type); + return super.processInLongOutLong(type, val); } /** diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/datastreamer/PlatformDataStreamer.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/datastreamer/PlatformDataStreamer.java index 2822b7f9125b6..cd5fba059c218 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/datastreamer/PlatformDataStreamer.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/datastreamer/PlatformDataStreamer.java @@ -217,14 +217,7 @@ else if (plc == PLC_FLUSH) return TRUE; } - } - - return super.processInLongOutLong(type, val); - } - /** {@inheritDoc} */ - @Override public long processOutLong(int type) throws IgniteCheckedException { - switch (type) { case OP_ALLOW_OVERWRITE: return ldr.allowOverwrite() ? TRUE : FALSE; @@ -238,7 +231,7 @@ else if (plc == PLC_FLUSH) return ldr.perNodeParallelOperations(); } - return super.processOutLong(type); + return super.processInLongOutLong(type, val); } /** diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/datastructures/PlatformAtomicLong.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/datastructures/PlatformAtomicLong.java index 53319560f95c1..811e38bcadd79 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/datastructures/PlatformAtomicLong.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/datastructures/PlatformAtomicLong.java @@ -99,8 +99,17 @@ public PlatformAtomicLong(PlatformContext ctx, GridCacheAtomicLongImpl atomicLon } /** {@inheritDoc} */ - @Override protected long processOutLong(int type) throws IgniteCheckedException { + @Override protected long processInLongOutLong(int type, long val) throws IgniteCheckedException { switch (type) { + case OP_ADD_AND_GET: + return atomicLong.addAndGet(val); + + case OP_GET_AND_ADD: + return atomicLong.getAndAdd(val); + + case OP_GET_AND_SET: + return atomicLong.getAndSet(val); + case OP_CLOSE: atomicLong.close(); @@ -125,22 +134,6 @@ public PlatformAtomicLong(PlatformContext ctx, GridCacheAtomicLongImpl atomicLon return atomicLong.removed() ? TRUE : FALSE; } - return super.processOutLong(type); - } - - /** {@inheritDoc} */ - @Override protected long processInLongOutLong(int type, long val) throws IgniteCheckedException { - switch (type) { - case OP_ADD_AND_GET: - return atomicLong.addAndGet(val); - - case OP_GET_AND_ADD: - return atomicLong.getAndAdd(val); - - case OP_GET_AND_SET: - return atomicLong.getAndSet(val); - } - return super.processInLongOutLong(type, val); } } diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/datastructures/PlatformAtomicReference.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/datastructures/PlatformAtomicReference.java index e5fc08d8b69e4..63b5b86ec6b69 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/datastructures/PlatformAtomicReference.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/datastructures/PlatformAtomicReference.java @@ -24,7 +24,6 @@ import org.apache.ignite.internal.processors.platform.PlatformAbstractTarget; import org.apache.ignite.internal.processors.platform.PlatformContext; import org.apache.ignite.internal.processors.platform.memory.PlatformMemory; -import org.omg.CORBA.TRANSACTION_REQUIRED; /** * Platform atomic reference wrapper. @@ -135,7 +134,7 @@ private PlatformAtomicReference(PlatformContext ctx, GridCacheAtomicReferenceImp } /** {@inheritDoc} */ - @Override protected long processOutLong(int type) throws IgniteCheckedException { + @Override protected long processInLongOutLong(int type, long val) throws IgniteCheckedException { switch (type) { case OP_CLOSE: atomicRef.close(); @@ -146,7 +145,6 @@ private PlatformAtomicReference(PlatformContext ctx, GridCacheAtomicReferenceImp return atomicRef.removed() ? TRUE : FALSE; } - return super.processOutLong(type); + return super.processInLongOutLong(type, val); } -} - +} \ No newline at end of file diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/datastructures/PlatformAtomicSequence.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/datastructures/PlatformAtomicSequence.java index ec946cac303e1..c35273189f13f 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/datastructures/PlatformAtomicSequence.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/datastructures/PlatformAtomicSequence.java @@ -71,8 +71,19 @@ public PlatformAtomicSequence(PlatformContext ctx, IgniteAtomicSequence atomicSe /** {@inheritDoc} */ - @Override protected long processOutLong(int type) throws IgniteCheckedException { + @Override protected long processInLongOutLong(int type, long val) throws IgniteCheckedException { switch (type) { + case OP_ADD_AND_GET: + return atomicSeq.addAndGet(val); + + case OP_GET_AND_ADD: + return atomicSeq.getAndAdd(val); + + case OP_SET_BATCH_SIZE: + atomicSeq.batchSize((int)val); + + return TRUE; + case OP_CLOSE: atomicSeq.close(); @@ -94,24 +105,6 @@ public PlatformAtomicSequence(PlatformContext ctx, IgniteAtomicSequence atomicSe return atomicSeq.batchSize(); } - return super.processOutLong(type); - } - - /** {@inheritDoc} */ - @Override protected long processInLongOutLong(int type, long val) throws IgniteCheckedException { - switch (type) { - case OP_ADD_AND_GET: - return atomicSeq.addAndGet(val); - - case OP_GET_AND_ADD: - return atomicSeq.getAndAdd(val); - - case OP_SET_BATCH_SIZE: - atomicSeq.batchSize((int)val); - - return TRUE; - } - return super.processInLongOutLong(type, val); } } diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/services/PlatformServices.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/services/PlatformServices.java index 7aaf5970a9118..dc6350363bcb0 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/services/PlatformServices.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/services/PlatformServices.java @@ -205,7 +205,7 @@ private ServiceDescriptor findDescriptor(String name) { } /** {@inheritDoc} */ - @Override protected void processInObjectStreamOutStream(int type, Object arg, BinaryRawReaderEx reader, + @Override protected Object processInObjectStreamOutObjectStream(int type, Object arg, BinaryRawReaderEx reader, BinaryRawWriterEx writer) throws IgniteCheckedException { switch (type) { case OP_INVOKE: { @@ -234,12 +234,11 @@ private ServiceDescriptor findDescriptor(String name) { PlatformUtils.writeInvocationResult(writer, null, e); } - return; + return null; } - - default: - super.processInObjectStreamOutStream(type, arg, reader, writer); } + + return super.processInObjectStreamOutObjectStream(type, arg, reader, writer); } /** {@inheritDoc} */ @@ -298,7 +297,7 @@ private ServiceDescriptor findDescriptor(String name) { } /** {@inheritDoc} */ - @Override protected long processOutLong(int type) throws IgniteCheckedException { + @Override protected long processInLongOutLong(int type, long val) throws IgniteCheckedException { switch (type) { case OP_CANCEL_ALL: services.cancelAll(); @@ -306,7 +305,7 @@ private ServiceDescriptor findDescriptor(String name) { return TRUE; } - return super.processOutLong(type); + return super.processInLongOutLong(type, val); } /** {@inheritDoc} */ diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/transactions/PlatformTransactions.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/transactions/PlatformTransactions.java index 339937c98fc67..92d8b53decfd8 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/transactions/PlatformTransactions.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/transactions/PlatformTransactions.java @@ -168,18 +168,6 @@ private Transaction tx(long id) { return tx; } - /** {@inheritDoc} */ - @Override protected long processOutLong(int type) throws IgniteCheckedException { - switch (type) { - case OP_RESET_METRICS: - txs.resetMetrics(); - - return TRUE; - } - - return super.processOutLong(type); - } - /** {@inheritDoc} */ @Override protected long processInLongOutLong(int type, long val) throws IgniteCheckedException { switch (type) { @@ -201,6 +189,11 @@ private Transaction tx(long id) { case OP_STATE: return tx(val).state().ordinal(); + + case OP_RESET_METRICS: + txs.resetMetrics(); + + return TRUE; } return super.processInLongOutLong(type, val); diff --git a/modules/platforms/cpp/core/src/impl/cache/query/query_impl.cpp b/modules/platforms/cpp/core/src/impl/cache/query/query_impl.cpp index c65e1e8ee5958..aaeb8228367f1 100644 --- a/modules/platforms/cpp/core/src/impl/cache/query/query_impl.cpp +++ b/modules/platforms/cpp/core/src/impl/cache/query/query_impl.cpp @@ -67,7 +67,7 @@ namespace ignite delete batch; // 2. Close the cursor. - env.Get()->Context()->TargetOutLong(javaRef, OP_ITERATOR_CLOSE); + env.Get()->Context()->TargetInLongOutLong(javaRef, OP_ITERATOR_CLOSE, 0); // 3. Release Java reference. JniContext::Release(javaRef); @@ -199,7 +199,7 @@ namespace ignite JniErrorInfo jniErr; - env.Get()->Context()->TargetOutLong(javaRef, OP_ITERATOR, &jniErr); + env.Get()->Context()->TargetInLongOutLong(javaRef, OP_ITERATOR, 0, &jniErr); IgniteError::SetError(jniErr.code, jniErr.errCls, jniErr.errMsg, &err); @@ -249,7 +249,7 @@ namespace ignite { JniErrorInfo jniErr; - bool res = env.Get()->Context()->TargetOutLong(javaRef, OP_ITERATOR_HAS_NEXT, &jniErr) == 1; + bool res = env.Get()->Context()->TargetInLongOutLong(javaRef, OP_ITERATOR_HAS_NEXT, 0, &jniErr) == 1; IgniteError::SetError(jniErr.code, jniErr.errCls, jniErr.errMsg, &err); diff --git a/modules/platforms/cpp/core/src/impl/interop/interop_target.cpp b/modules/platforms/cpp/core/src/impl/interop/interop_target.cpp index 592c1ba2eb93a..b0c7b893cb584 100644 --- a/modules/platforms/cpp/core/src/impl/interop/interop_target.cpp +++ b/modules/platforms/cpp/core/src/impl/interop/interop_target.cpp @@ -100,7 +100,7 @@ namespace ignite { JniErrorInfo jniErr; - long long res = env.Get()->Context()->TargetOutLong(javaRef, opType, &jniErr); + long long res = env.Get()->Context()->TargetInLongOutLong(javaRef, opType, 0, &jniErr); IgniteError::SetError(jniErr.code, jniErr.errCls, jniErr.errMsg, err); diff --git a/modules/platforms/cpp/jni/include/ignite/jni/exports.h b/modules/platforms/cpp/jni/include/ignite/jni/exports.h index 84f5a29f0c29f..e476cf83b8b6a 100644 --- a/modules/platforms/cpp/jni/include/ignite/jni/exports.h +++ b/modules/platforms/cpp/jni/include/ignite/jni/exports.h @@ -59,9 +59,7 @@ extern "C" { long long IGNITE_CALL IgniteTargetInStreamOutLong(gcj::JniContext* ctx, void* obj, int opType, long long memPtr); void IGNITE_CALL IgniteTargetInStreamOutStream(gcj::JniContext* ctx, void* obj, int opType, long long inMemPtr, long long outMemPtr); void* IGNITE_CALL IgniteTargetInStreamOutObject(gcj::JniContext* ctx, void* obj, int opType, long long memPtr); - void IGNITE_CALL IgniteTargetInObjectStreamOutStream(gcj::JniContext* ctx, void* obj, int opType, void* arg, long long inMemPtr, long long outMemPtr); void* IGNITE_CALL IgniteTargetInObjectStreamOutObjectStream(gcj::JniContext* ctx, void* obj, int opType, void* arg, long long inMemPtr, long long outMemPtr); - long long IGNITE_CALL IgniteTargetOutLong(gcj::JniContext* ctx, void* obj, int opType); 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 IgniteTargetListenFuture(gcj::JniContext* ctx, void* obj, long long futId, int typ); diff --git a/modules/platforms/cpp/jni/include/ignite/jni/java.h b/modules/platforms/cpp/jni/include/ignite/jni/java.h index 96daba8270f65..1f2de2e1fe778 100644 --- a/modules/platforms/cpp/jni/include/ignite/jni/java.h +++ b/modules/platforms/cpp/jni/include/ignite/jni/java.h @@ -261,11 +261,9 @@ namespace ignite jmethodID m_PlatformTarget_inLongOutLong; jmethodID m_PlatformTarget_inStreamOutLong; jmethodID m_PlatformTarget_inStreamOutObject; - jmethodID m_PlatformTarget_outLong; jmethodID m_PlatformTarget_outStream; jmethodID m_PlatformTarget_outObject; jmethodID m_PlatformTarget_inStreamOutStream; - jmethodID m_PlatformTarget_inObjectStreamOutStream; jmethodID m_PlatformTarget_inObjectStreamOutObjectStream; jmethodID m_PlatformTarget_listenFuture; jmethodID m_PlatformTarget_listenFutureForOperation; @@ -441,9 +439,7 @@ namespace ignite long long TargetInStreamOutLong(jobject obj, int type, long long memPtr, JniErrorInfo* errInfo = NULL); void TargetInStreamOutStream(jobject obj, int opType, long long inMemPtr, long long outMemPtr, JniErrorInfo* errInfo = NULL); jobject TargetInStreamOutObject(jobject obj, int type, long long memPtr, JniErrorInfo* errInfo = NULL); - void TargetInObjectStreamOutStream(jobject obj, int opType, void* arg, long long inMemPtr, long long outMemPtr, JniErrorInfo* errInfo = NULL); jobject TargetInObjectStreamOutObjectStream(jobject obj, int opType, void* arg, long long inMemPtr, long long outMemPtr, JniErrorInfo* errInfo = NULL); - long long TargetOutLong(jobject obj, int opType, 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 TargetListenFuture(jobject obj, long long futId, int typ); diff --git a/modules/platforms/cpp/jni/project/vs/module.def b/modules/platforms/cpp/jni/project/vs/module.def index c2069b6a91e19..7930b5a0190a2 100644 --- a/modules/platforms/cpp/jni/project/vs/module.def +++ b/modules/platforms/cpp/jni/project/vs/module.def @@ -6,7 +6,6 @@ IgniteIgnitionInstance @3 IgniteIgnitionEnvironmentPointer @4 IgniteIgnitionStop @5 IgniteIgnitionStopAll @6 -IgniteTargetOutLong @7 IgniteProcessorReleaseStart @8 IgniteProcessorProjection @9 IgniteProcessorCache @10 @@ -20,7 +19,7 @@ IgniteTargetInStreamOutObject @17 IgniteTargetInStreamOutLong @18 IgniteTargetOutStream @19 IgniteTargetInStreamOutStream @20 -IgniteTargetInObjectStreamOutStream @21 +IgniteTargetInObjectStreamOutObjectStream @21 IgniteTargetListenFuture @22 IgniteTargetListenFutureForOperation @23 IgniteTargetInLongOutLong @24 diff --git a/modules/platforms/cpp/jni/src/exports.cpp b/modules/platforms/cpp/jni/src/exports.cpp index ca332be619084..76f38ce9e0505 100644 --- a/modules/platforms/cpp/jni/src/exports.cpp +++ b/modules/platforms/cpp/jni/src/exports.cpp @@ -154,18 +154,10 @@ extern "C" { return ctx->TargetInStreamOutObject(static_cast(obj), opType, memPtr); } - void IGNITE_CALL IgniteTargetInObjectStreamOutStream(gcj::JniContext* ctx, void* obj, int opType, void* arg, long long inMemPtr, long long outMemPtr) { - ctx->TargetInObjectStreamOutStream(static_cast(obj), opType, arg, inMemPtr, outMemPtr); - } - void* IGNITE_CALL IgniteTargetInObjectStreamOutObjectStream(gcj::JniContext* ctx, void* obj, int opType, void* arg, long long inMemPtr, long long outMemPtr) { return ctx->TargetInObjectStreamOutObjectStream(static_cast(obj), opType, arg, inMemPtr, outMemPtr); } - long long IGNITE_CALL IgniteTargetOutLong(gcj::JniContext* ctx, void* obj, int opType) { - return ctx->TargetOutLong(static_cast(obj), opType); - } - void IGNITE_CALL IgniteTargetOutStream(gcj::JniContext* ctx, void* obj, int opType, long long memPtr) { ctx->TargetOutStream(static_cast(obj), opType, memPtr); } diff --git a/modules/platforms/cpp/jni/src/java.cpp b/modules/platforms/cpp/jni/src/java.cpp index 5bbaac402ba50..4c16976be1e1f 100644 --- a/modules/platforms/cpp/jni/src/java.cpp +++ b/modules/platforms/cpp/jni/src/java.cpp @@ -218,9 +218,7 @@ namespace ignite JniMethod M_PLATFORM_TARGET_IN_STREAM_OUT_LONG = JniMethod("inStreamOutLong", "(IJ)J", false); JniMethod M_PLATFORM_TARGET_IN_STREAM_OUT_OBJECT = JniMethod("inStreamOutObject", "(IJ)Ljava/lang/Object;", false); JniMethod M_PLATFORM_TARGET_IN_STREAM_OUT_STREAM = JniMethod("inStreamOutStream", "(IJJ)V", false); - JniMethod M_PLATFORM_TARGET_IN_OBJECT_STREAM_OUT_STREAM = JniMethod("inObjectStreamOutStream", "(ILjava/lang/Object;JJ)V", false); 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_LONG = JniMethod("outLong", "(I)J", 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_LISTEN_FUTURE = JniMethod("listenFuture", "(JI)V", false); @@ -512,11 +510,9 @@ namespace ignite m_PlatformTarget_inLongOutLong = FindMethod(env, c_PlatformTarget, M_PLATFORM_TARGET_IN_LONG_OUT_LONG); m_PlatformTarget_inStreamOutLong = FindMethod(env, c_PlatformTarget, M_PLATFORM_TARGET_IN_STREAM_OUT_LONG); m_PlatformTarget_inStreamOutObject = FindMethod(env, c_PlatformTarget, M_PLATFORM_TARGET_IN_STREAM_OUT_OBJECT); - m_PlatformTarget_outLong = FindMethod(env, c_PlatformTarget, M_PLATFORM_TARGET_OUT_LONG); m_PlatformTarget_outStream = FindMethod(env, c_PlatformTarget, M_PLATFORM_TARGET_OUT_STREAM); 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_inObjectStreamOutStream = FindMethod(env, c_PlatformTarget, M_PLATFORM_TARGET_IN_OBJECT_STREAM_OUT_STREAM); m_PlatformTarget_inObjectStreamOutObjectStream = FindMethod(env, c_PlatformTarget, M_PLATFORM_TARGET_IN_OBJECT_STREAM_OUT_OBJECT_STREAM); 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); @@ -1295,14 +1291,6 @@ namespace ignite return LocalToGlobal(env, res); } - void JniContext::TargetInObjectStreamOutStream(jobject obj, int opType, void* arg, long long inMemPtr, long long outMemPtr, JniErrorInfo* err) { - JNIEnv* env = Attach(); - - env->CallVoidMethod(obj, jvm->GetMembers().m_PlatformTarget_inObjectStreamOutStream, opType, arg, inMemPtr, outMemPtr); - - ExceptionCheck(env, err); - } - jobject JniContext::TargetInObjectStreamOutObjectStream(jobject obj, int opType, void* arg, long long inMemPtr, long long outMemPtr, JniErrorInfo* err) { JNIEnv* env = Attach(); @@ -1313,17 +1301,6 @@ namespace ignite return LocalToGlobal(env, res); } - long long JniContext::TargetOutLong(jobject obj, int opType, JniErrorInfo* err) - { - JNIEnv* env = Attach(); - - jlong res = env->CallLongMethod(obj, jvm->GetMembers().m_PlatformTarget_outLong, opType); - - ExceptionCheck(env, err); - - return res; - } - void JniContext::TargetOutStream(jobject obj, int opType, long long memPtr, JniErrorInfo* err) { JNIEnv* env = Attach(); diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/CacheAffinityImpl.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/CacheAffinityImpl.cs index 4ff1f2e5281c1..f09a119700014 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/CacheAffinityImpl.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/CacheAffinityImpl.cs @@ -104,7 +104,7 @@ internal class CacheAffinityImpl : PlatformTarget, ICacheAffinity /** */ public int Partitions { - get { return (int) DoOutOp(OpPartitions); } + get { return (int) DoOutInOp(OpPartitions); } } /** */ diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/CacheImpl.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/CacheImpl.cs index 3a82932bf9f54..2cc88e4142b8a 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/CacheImpl.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/CacheImpl.cs @@ -640,7 +640,7 @@ public void LocalEvict(IEnumerable keys) /** */ public void Clear() { - DoOutOp((int) CacheOp.ClearCache); + DoOutInOp((int) CacheOp.ClearCache); } /** */ @@ -752,7 +752,7 @@ public Task RemoveAllAsync(IEnumerable keys) /** */ public void RemoveAll() { - DoOutOp((int) CacheOp.RemoveAll2); + DoOutInOp((int) CacheOp.RemoveAll2); } /** */ @@ -795,7 +795,7 @@ private int Size0(bool loc, params CachePeekMode[] modes) var op = loc ? CacheOp.SizeLoc : CacheOp.Size; - return (int) DoOutInOpLong((int) op, modes0); + return (int) DoOutInOp((int) op, modes0); } /** */ @@ -919,7 +919,7 @@ public ICacheMetrics GetMetrics() /** */ public Task Rebalance() { - return GetFuture((futId, futTyp) => DoOutInOpLong((int) CacheOp.Rebalance, futId)).Task; + return GetFuture((futId, futTyp) => DoOutInOp((int) CacheOp.Rebalance, futId)).Task; } /** */ @@ -1273,7 +1273,7 @@ private CacheResult DoOutInOpNullable(int type, Action out /** */ public void Enter(long id) { - DoOutInOpLong((int) CacheOp.EnterLock, id); + DoOutInOp((int) CacheOp.EnterLock, id); } /** */ @@ -1289,13 +1289,13 @@ public bool TryEnter(long id, TimeSpan timeout) /** */ public void Exit(long id) { - DoOutInOpLong((int) CacheOp.ExitLock, id); + DoOutInOp((int) CacheOp.ExitLock, id); } /** */ public void Close(long id) { - DoOutInOpLong((int) CacheOp.CloseLock, id); + DoOutInOp((int) CacheOp.CloseLock, id); } } } diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/Query/AbstractQueryCursor.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/Query/AbstractQueryCursor.cs index e6092d7ddb115..95c6a36f59985 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/Query/AbstractQueryCursor.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/Query/AbstractQueryCursor.cs @@ -100,7 +100,7 @@ protected override void Dispose(bool disposing) { try { - DoOutOp(OpIteratorClose); + DoOutInOp(OpIteratorClose); } finally { @@ -125,7 +125,7 @@ public IEnumerator GetEnumerator() throw new InvalidOperationException("Failed to get enumerator entries because " + "GetAll() method has already been called."); - DoOutOp(OpIterator); + DoOutInOp(OpIterator); _iterCalled = true; diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/Query/Continuous/ContinuousQueryHandleImpl.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/Query/Continuous/ContinuousQueryHandleImpl.cs index b66dc48b332c2..6139d8be51fdd 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/Query/Continuous/ContinuousQueryHandleImpl.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/Query/Continuous/ContinuousQueryHandleImpl.cs @@ -225,7 +225,7 @@ public void Dispose() try { - UU.TargetOutLong(_nativeQry, 0); + UU.TargetInLongOutLong(_nativeQry, 0, 0); } finally { diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Compute/ComputeImpl.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Compute/ComputeImpl.cs index 1b2e2aa914ef8..36d731d884ed0 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Compute/ComputeImpl.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Compute/ComputeImpl.cs @@ -106,7 +106,7 @@ public IClusterGroup ClusterGroup /// public void WithNoFailover() { - DoOutOp(OpWithNoFailover); + DoOutInOp(OpWithNoFailover); } /// @@ -116,7 +116,7 @@ public void WithNoFailover() /// Computation timeout in milliseconds. public void WithTimeout(long timeout) { - DoOutInOpLong(OpWithTimeout, timeout); + DoOutInOp(OpWithTimeout, timeout); } /// diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/DataStructures/AtomicLong.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/DataStructures/AtomicLong.cs index 571e6fd2707c0..0c4bf84b17ceb 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/DataStructures/AtomicLong.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/DataStructures/AtomicLong.cs @@ -68,31 +68,31 @@ public string Name /** */ public long Read() { - return DoOutOp((int) Op.Get); + return DoOutInOp((int) Op.Get); } /** */ public long Increment() { - return DoOutOp((int) Op.IncrementAndGet); + return DoOutInOp((int) Op.IncrementAndGet); } /** */ public long Add(long value) { - return DoOutInOpLong((int) Op.AddAndGet, value); + return DoOutInOp((int) Op.AddAndGet, value); } /** */ public long Decrement() { - return DoOutOp((int) Op.DecrementAndGet); + return DoOutInOp((int) Op.DecrementAndGet); } /** */ public long Exchange(long value) { - return DoOutInOpLong((int) Op.GetAndSet, value); + return DoOutInOp((int) Op.GetAndSet, value); } /** */ @@ -108,13 +108,13 @@ public long CompareExchange(long value, long comparand) /** */ public void Close() { - DoOutOp((int) Op.Close); + DoOutInOp((int) Op.Close); } /** */ public bool IsClosed() { - return DoOutOp((int) Op.IsClosed) == True; + return DoOutInOp((int) Op.IsClosed) == True; } } } \ No newline at end of file diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/DataStructures/AtomicReference.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/DataStructures/AtomicReference.cs index 75e36d1c73b91..4ca4b249b3b2a 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/DataStructures/AtomicReference.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/DataStructures/AtomicReference.cs @@ -82,13 +82,13 @@ public T CompareExchange(T value, T comparand) /** */ public bool IsClosed { - get { return DoOutOp((int) Op.IsClosed) == True; } + get { return DoOutInOp((int) Op.IsClosed) == True; } } /** */ public void Close() { - DoOutOp((int) Op.Close); + DoOutInOp((int) Op.Close); } } } diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/DataStructures/AtomicSequence.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/DataStructures/AtomicSequence.cs index b7b924ed246a0..f7fc6b7fb2e44 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/DataStructures/AtomicSequence.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/DataStructures/AtomicSequence.cs @@ -65,38 +65,38 @@ public string Name /** */ public long Read() { - return DoOutOp((int) Op.Get); + return DoOutInOp((int) Op.Get); } /** */ public long Increment() { - return DoOutOp((int) Op.IncrementAndGet); + return DoOutInOp((int) Op.IncrementAndGet); } /** */ public long Add(long value) { - return DoOutInOpLong((int) Op.AddAndGet, value); + return DoOutInOp((int) Op.AddAndGet, value); } /** */ public int BatchSize { - get { return (int) DoOutOp((int) Op.GetBatchSize); } - set { DoOutInOpLong((int) Op.SetBatchSize, value); } + get { return (int) DoOutInOp((int) Op.GetBatchSize); } + set { DoOutInOp((int) Op.SetBatchSize, value); } } /** */ public bool IsClosed { - get { return DoOutOp((int) Op.IsClosed) == True; } + get { return DoOutInOp((int) Op.IsClosed) == True; } } /** */ public void Close() { - DoOutOp((int) Op.Close); + DoOutInOp((int) Op.Close); } } } diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Datastream/DataStreamerImpl.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Datastream/DataStreamerImpl.cs index 8893fc5558695..b9e3030e90c4c 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Datastream/DataStreamerImpl.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Datastream/DataStreamerImpl.cs @@ -156,7 +156,7 @@ public DataStreamerImpl(IUnmanagedTarget target, Marshaller marsh, string cacheN _hnd = marsh.Ignite.HandleRegistry.Allocate(thisRef); // Start topology listening. This call will ensure that buffer size member is updated. - DoOutInOpLong(OpListenTopology, _hnd); + DoOutInOp(OpListenTopology, _hnd); // Membar to ensure fields initialization before leaving constructor. Thread.MemoryBarrier(); @@ -184,7 +184,7 @@ public bool AllowOverwrite { ThrowIfDisposed(); - return DoOutOp(OpAllowOverwrite) == True; + return DoOutInOp(OpAllowOverwrite) == True; } finally { @@ -199,7 +199,7 @@ public bool AllowOverwrite { ThrowIfDisposed(); - DoOutInOpLong(OpSetAllowOverwrite, value ? True : False); + DoOutInOp(OpSetAllowOverwrite, value ? True : False); } finally { @@ -219,7 +219,7 @@ public bool SkipStore { ThrowIfDisposed(); - return DoOutOp(OpSkipStore) == True; + return DoOutInOp(OpSkipStore) == True; } finally { @@ -234,7 +234,7 @@ public bool SkipStore { ThrowIfDisposed(); - DoOutInOpLong(OpSetSkipStore, value ? True : False); + DoOutInOp(OpSetSkipStore, value ? True : False); } finally { @@ -254,7 +254,7 @@ public int PerNodeBufferSize { ThrowIfDisposed(); - return (int) DoOutOp(OpPerNodeBufferSize); + return (int) DoOutInOp(OpPerNodeBufferSize); } finally { @@ -269,7 +269,7 @@ public int PerNodeBufferSize { ThrowIfDisposed(); - DoOutInOpLong(OpSetPerNodeBufferSize, value); + DoOutInOp(OpSetPerNodeBufferSize, value); _bufSndSize = _topSize * value; } @@ -291,7 +291,7 @@ public int PerNodeParallelOperations { ThrowIfDisposed(); - return (int) DoOutOp(OpPerNodeParallelOps); + return (int) DoOutInOp(OpPerNodeParallelOps); } finally { @@ -307,7 +307,7 @@ public int PerNodeParallelOperations { ThrowIfDisposed(); - DoOutInOpLong(OpSetPerNodeParallelOps, value); + DoOutInOp(OpSetPerNodeParallelOps, value); } finally { @@ -598,7 +598,7 @@ public void TopologyChange(long topVer, int topSize) _topVer = topVer; _topSize = topSize > 0 ? topSize : 1; // Do not set to 0 to avoid 0 buffer size. - _bufSndSize = (int) (_topSize * DoOutOp(OpPerNodeBufferSize)); + _bufSndSize = (int) (_topSize * DoOutInOp(OpPerNodeBufferSize)); } } finally diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Events/Events.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Events/Events.cs index 5d1add640466c..db2b8d22b8c20 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Events/Events.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Events/Events.cs @@ -339,7 +339,7 @@ public void RecordLocal(IEvent evt) // Should do this inside lock to avoid race with subscription // ToArray is required because we are going to modify underlying dictionary during enumeration foreach (var filter in GetLocalFilters(listener, types).ToArray()) - success |= (DoOutInOpLong((int) Op.StopLocalListen, filter.Handle) == True); + success |= (DoOutInOp((int) Op.StopLocalListen, filter.Handle) == True); return success; } @@ -388,7 +388,7 @@ public ICollection GetEnabledEvents() /** */ public bool IsEnabled(int type) { - return DoOutInOpLong((int) Op.IsEnabled, type) == True; + return DoOutInOp((int) Op.IsEnabled, type) == True; } /// diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Ignite.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Ignite.cs index 675af5e63931b..e2fd3860321fc 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Ignite.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Ignite.cs @@ -486,7 +486,7 @@ public ICollection GetTopology(long ver) /** */ public void ResetMetrics() { - UU.TargetOutLong(_prj.Target, ClusterGroupImpl.OpResetMetrics); + UU.TargetInLongOutLong(_prj.Target, ClusterGroupImpl.OpResetMetrics, 0); } /** */ diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/PlatformTarget.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/PlatformTarget.cs index 8c065bcc7249a..f7906ff5a052e 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/PlatformTarget.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/PlatformTarget.cs @@ -255,16 +255,6 @@ protected static BinaryWriter WriteEnumerable(BinaryWriter writer, IEnumerabl #region OUT operations - /// - /// Perform out operation. - /// - /// Operation type. - /// Long result. - protected long DoOutOp(int type) - { - return UU.TargetOutLong(_target, type); - } - /// /// Perform out operation. /// @@ -494,35 +484,6 @@ protected TR DoOutInOp(int type, Action outAction, Func - /// Perform out-in operation. - /// - /// Operation type. - /// Out action. - /// In action. - /// Argument. - /// Result. - protected unsafe TR DoOutInOp(int type, Action outAction, Func inAction, void* arg) - { - using (PlatformMemoryStream outStream = IgniteManager.Memory.Allocate().GetStream()) - { - using (PlatformMemoryStream inStream = IgniteManager.Memory.Allocate().GetStream()) - { - BinaryWriter writer = _marsh.StartMarshal(outStream); - - outAction(writer); - - FinishMarshal(writer); - - UU.TargetInObjectStreamOutStream(_target, type, arg, outStream.SynchronizeOutput(), inStream.MemoryPointer); - - inStream.SynchronizeInput(); - - return inAction(inStream); - } - } - } - /// /// Perform out-in operation. /// @@ -672,7 +633,7 @@ protected TR DoOutInOp(int type, Action outAction) /// Operation type. /// Value. /// Result. - protected long DoOutInOpLong(int type, long val) + protected long DoOutInOp(int type, long val = 0) { return UU.TargetInLongOutLong(_target, type, val); } diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Services/Services.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Services/Services.cs index d6b1d054b74b8..3e72147b48480 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Services/Services.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Services/Services.cs @@ -273,7 +273,7 @@ public Task CancelAsync(string name) /** */ public void CancelAll() { - DoOutOp(OpCancelAll); + DoOutInOp(OpCancelAll); } /** */ @@ -390,7 +390,7 @@ public ICollection GetServices(string name) { return DoOutInOp(OpInvokeMethod, writer => ServiceProxySerializer.WriteProxyMethod(writer, method, args, platform), - stream => ServiceProxySerializer.ReadInvocationResult(stream, Marshaller, _keepBinary), proxy.Target); + (stream, res) => ServiceProxySerializer.ReadInvocationResult(stream, Marshaller, _keepBinary), proxy.Target); } } } diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Transactions/TransactionsImpl.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Transactions/TransactionsImpl.cs index 796044d8d902f..81352e9bcae11 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Transactions/TransactionsImpl.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Transactions/TransactionsImpl.cs @@ -156,7 +156,7 @@ public ITransactionMetrics GetMetrics() /** */ public void ResetMetrics() { - DoOutOp(OpResetMetrics); + DoOutInOp(OpResetMetrics); } /// @@ -166,7 +166,7 @@ public void ResetMetrics() /// Final transaction state. internal TransactionState TxCommit(TransactionImpl tx) { - return (TransactionState) DoOutInOpLong(OpCommit, tx.Id); + return (TransactionState) DoOutInOp(OpCommit, tx.Id); } /// @@ -176,7 +176,7 @@ internal TransactionState TxCommit(TransactionImpl tx) /// Final transaction state. internal TransactionState TxRollback(TransactionImpl tx) { - return (TransactionState) DoOutInOpLong(OpRollback, tx.Id); + return (TransactionState) DoOutInOp(OpRollback, tx.Id); } /// @@ -186,7 +186,7 @@ internal TransactionState TxRollback(TransactionImpl tx) /// Final transaction state. internal int TxClose(TransactionImpl tx) { - return (int) DoOutInOpLong(OpClose, tx.Id); + return (int) DoOutInOp(OpClose, tx.Id); } /// @@ -196,7 +196,7 @@ internal int TxClose(TransactionImpl tx) /// Transaction current state. internal TransactionState TxState(TransactionImpl tx) { - return (TransactionState) DoOutInOpLong(OpState, tx.Id); + return (TransactionState) DoOutInOp(OpState, tx.Id); } /// @@ -206,7 +206,7 @@ internal TransactionState TxState(TransactionImpl tx) /// true if the flag was set. internal bool TxSetRollbackOnly(TransactionImpl tx) { - return DoOutInOpLong(OpSetRollbackOnly, tx.Id) == True; + return DoOutInOp(OpSetRollbackOnly, tx.Id) == True; } /// 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 8de82ee04a09c..296ca38bb4305 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Unmanaged/IgniteJniNativeMethods.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Unmanaged/IgniteJniNativeMethods.cs @@ -124,19 +124,12 @@ internal static unsafe class IgniteJniNativeMethods long outMemPtr); [DllImport(IgniteUtils.FileIgniteJniDll, EntryPoint = "IgniteTargetInStreamOutObject")] - public static extern void* TargetInStreanOutObject(void* ctx, void* target, int opType, long memPtr); - - [DllImport(IgniteUtils.FileIgniteJniDll, EntryPoint = "IgniteTargetInObjectStreamOutStream")] - public static extern void TargetInObjectStreamOutStream(void* ctx, void* target, int opType, - void* arg, long inMemPtr, long outMemPtr); + public static extern void* TargetInStreamOutObject(void* ctx, void* target, int opType, long memPtr); [DllImport(IgniteUtils.FileIgniteJniDll, EntryPoint = "IgniteTargetInObjectStreamOutObjectStream")] public static extern void* TargetInObjectStreamOutObjectStream(void* ctx, void* target, int opType, void* arg, long inMemPtr, long outMemPtr); - [DllImport(IgniteUtils.FileIgniteJniDll, EntryPoint = "IgniteTargetOutLong")] - public static extern long TargetOutLong(void* ctx, void* target, int opType); - [DllImport(IgniteUtils.FileIgniteJniDll, EntryPoint = "IgniteTargetOutStream")] public static extern void TargetOutStream(void* ctx, void* target, int opType, long memPtr); 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 4722d0b17b92f..65e22965931ec 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Unmanaged/UnmanagedUtils.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Unmanaged/UnmanagedUtils.cs @@ -382,16 +382,11 @@ internal static void TargetInStreamOutStream(IUnmanagedTarget target, int opType internal static IUnmanagedTarget TargetInStreamOutObject(IUnmanagedTarget target, int opType, long inMemPtr) { - void* res = JNI.TargetInStreanOutObject(target.Context, target.Target, opType, inMemPtr); + void* res = JNI.TargetInStreamOutObject(target.Context, target.Target, opType, inMemPtr); return target.ChangeTarget(res); } - internal static void TargetInObjectStreamOutStream(IUnmanagedTarget target, int opType, void* arg, long inMemPtr, long outMemPtr) - { - JNI.TargetInObjectStreamOutStream(target.Context, target.Target, opType, arg, inMemPtr, outMemPtr); - } - internal static IUnmanagedTarget TargetInObjectStreamOutObjectStream(IUnmanagedTarget target, int opType, void* arg, long inMemPtr, long outMemPtr) { void* res = JNI.TargetInObjectStreamOutObjectStream(target.Context, target.Target, opType, arg, inMemPtr, outMemPtr); @@ -402,11 +397,6 @@ internal static IUnmanagedTarget TargetInObjectStreamOutObjectStream(IUnmanagedT return target.ChangeTarget(res); } - internal static long TargetOutLong(IUnmanagedTarget target, int opType) - { - return JNI.TargetOutLong(target.Context, target.Target, opType); - } - internal static void TargetOutStream(IUnmanagedTarget target, int opType, long memPtr) { JNI.TargetOutStream(target.Context, target.Target, opType, memPtr);