http://git-wip-us.apache.org/repos/asf/ignite/blob/eaf8ae24/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/CacheLock.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/CacheLock.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/CacheLock.cs index ceb3b05..960c930 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/CacheLock.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/CacheLock.cs @@ -21,8 +21,6 @@ namespace Apache.Ignite.Core.Impl.Cache using System.Diagnostics; using System.Threading; using Apache.Ignite.Core.Cache; - using Apache.Ignite.Core.Impl.Unmanaged; - using UU = Apache.Ignite.Core.Impl.Unmanaged.UnmanagedUtils; /// <summary> /// Cache lock implementation. @@ -32,8 +30,8 @@ namespace Apache.Ignite.Core.Impl.Cache /** Unique lock ID.*/ private readonly long _id; - /** Cache. */ - private readonly IUnmanagedTarget _cache; + /** Cache lock. */ + private readonly ICacheLockInternal _lock; /** State (-1 for disposed, >=0 for number of currently executing methods). */ private int _state; @@ -45,13 +43,13 @@ namespace Apache.Ignite.Core.Impl.Cache /// Initializes a new instance of the <see cref="CacheLock"/> class. /// </summary> /// <param name="id">Lock id.</param> - /// <param name="cache">Cache.</param> - public CacheLock(long id, IUnmanagedTarget cache) + /// <param name="cacheLock">Cache lock.</param> + public CacheLock(long id, ICacheLockInternal cacheLock) { - Debug.Assert(cache != null); + Debug.Assert(cacheLock != null); _id = id; - _cache = cache; + _lock = cacheLock; } /** <inheritDoc /> */ @@ -68,7 +66,7 @@ namespace Apache.Ignite.Core.Impl.Cache try { - UU.CacheEnterLock(_cache, _id); + _lock.Enter(_id); res = true; } @@ -104,7 +102,7 @@ namespace Apache.Ignite.Core.Impl.Cache try { - return res = UU.CacheTryEnterLock(_cache, _id, (long)timeout.TotalMilliseconds); + return res = _lock.TryEnter(_id, timeout); } finally { @@ -125,7 +123,7 @@ namespace Apache.Ignite.Core.Impl.Cache { ThrowIfDisposed(); - UU.CacheExitLock(_cache, _id); + _lock.Exit(_id); _counter--; } @@ -143,7 +141,7 @@ namespace Apache.Ignite.Core.Impl.Cache "The lock is being disposed while still being used. " + "It either is being held by a thread and/or has active waiters waiting to acquire the lock."); - UU.CacheCloseLock(_cache, _id); + _lock.Close(_id); _state = -1; @@ -156,7 +154,7 @@ namespace Apache.Ignite.Core.Impl.Cache /// </summary> ~CacheLock() { - UU.CacheCloseLock(_cache, _id); + _lock.Close(_id); } /// <summary>
http://git-wip-us.apache.org/repos/asf/ignite/blob/eaf8ae24/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/CacheOp.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/CacheOp.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/CacheOp.cs index 4c42bf3..713ab42 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/CacheOp.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/CacheOp.cs @@ -61,6 +61,22 @@ namespace Apache.Ignite.Core.Impl.Cache Replace2 = 37, Replace3 = 38, GetConfig = 39, - LoadAll = 40 + LoadAll = 40, + ClearCache = 41, + WithAsync = 42, + RemoveAll2 = 43, + WithKeepBinary = 44, + WithExpiryPolicy = 45, + WithNoRetries = 46, + WithSkipStore = 47, + Size = 48, + Iterator = 49, + LocIterator = 50, + EnterLock = 51, + ExitLock = 52, + TryEnterLock = 53, + CloseLock = 54, + Rebalance = 55, + SizeLoc = 56 } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ignite/blob/eaf8ae24/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/ICacheLockInternal.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/ICacheLockInternal.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/ICacheLockInternal.cs new file mode 100644 index 0000000..4329ed0 --- /dev/null +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/ICacheLockInternal.cs @@ -0,0 +1,47 @@ +/* + * 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. + */ + +namespace Apache.Ignite.Core.Impl.Cache +{ + using System; + + /// <summary> + /// Internal cache locking interface. + /// </summary> + internal interface ICacheLockInternal + { + /// <summary> + /// Enters the lock. + /// </summary> + void Enter(long id); + + /// <summary> + /// Tries to enter the lock. + /// </summary> + bool TryEnter(long id, TimeSpan timeout); + + /// <summary> + /// Exits the lock. + /// </summary> + void Exit(long id); + + /// <summary> + /// Closes the lock. + /// </summary> + void Close(long id); + } +} http://git-wip-us.apache.org/repos/asf/ignite/blob/eaf8ae24/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/Query/AbstractQueryCursor.cs ---------------------------------------------------------------------- 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 a22b247..e6092d7 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 @@ -37,6 +37,12 @@ namespace Apache.Ignite.Core.Impl.Cache.Query /** */ private const int OpGetBatch = 2; + /** */ + private const int OpIterator = 4; + + /** */ + private const int OpIteratorClose = 5; + /** Position before head. */ private const int BatchPosBeforeHead = -1; @@ -94,7 +100,7 @@ namespace Apache.Ignite.Core.Impl.Cache.Query { try { - UU.QueryCursorClose(Target); + DoOutOp(OpIteratorClose); } finally { @@ -119,7 +125,7 @@ namespace Apache.Ignite.Core.Impl.Cache.Query throw new InvalidOperationException("Failed to get enumerator entries because " + "GetAll() method has already been called."); - UU.QueryCursorIterator(Target); + DoOutOp(OpIterator); _iterCalled = true; http://git-wip-us.apache.org/repos/asf/ignite/blob/eaf8ae24/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/Query/Continuous/ContinuousQueryHandleImpl.cs ---------------------------------------------------------------------- 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 6cfbe92..b66dc48 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 @@ -48,7 +48,7 @@ namespace Apache.Ignite.Core.Impl.Cache.Query.Continuous /// <summary> /// Continuous query handle. /// </summary> - internal class ContinuousQueryHandleImpl<TK, TV> : IContinuousQueryHandleImpl, IContinuousQueryFilter, + internal class ContinuousQueryHandleImpl<TK, TV> : IContinuousQueryHandleImpl, IContinuousQueryFilter, IContinuousQueryHandle<ICacheEntry<TK, TV>> { /** Marshaller. */ @@ -64,11 +64,11 @@ namespace Apache.Ignite.Core.Impl.Cache.Query.Continuous private readonly ICacheEntryEventFilter<TK, TV> _filter; /** GC handle. */ - private long _hnd; + private readonly long _hnd; /** Native query. */ - private volatile IUnmanagedTarget _nativeQry; - + private readonly IUnmanagedTarget _nativeQry; + /** Initial query cursor. */ private volatile IQueryCursor<ICacheEntry<TK, TV>> _initialQueryCursor; @@ -81,64 +81,81 @@ namespace Apache.Ignite.Core.Impl.Cache.Query.Continuous /// <param name="qry">Query.</param> /// <param name="marsh">Marshaller.</param> /// <param name="keepBinary">Keep binary flag.</param> - public ContinuousQueryHandleImpl(ContinuousQuery<TK, TV> qry, Marshaller marsh, bool keepBinary) + /// <param name="createTargetCb">The initialization callback.</param> + /// <param name="initialQry">The initial query.</param> + public ContinuousQueryHandleImpl(ContinuousQuery<TK, TV> qry, Marshaller marsh, bool keepBinary, + Func<Action<BinaryWriter>, IUnmanagedTarget> createTargetCb, QueryBase initialQry) { _marsh = marsh; _keepBinary = keepBinary; _lsnr = qry.Listener; _filter = qry.Filter; - } - /// <summary> - /// Start execution. - /// </summary> - /// <param name="grid">Ignite instance.</param> - /// <param name="writer">Writer.</param> - /// <param name="cb">Callback invoked when all necessary data is written to stream.</param> - /// <param name="qry">Query.</param> - public void Start(Ignite grid, BinaryWriter writer, Func<IUnmanagedTarget> cb, - ContinuousQuery<TK, TV> qry) - { // 1. Inject resources. - ResourceProcessor.Inject(_lsnr, grid); - ResourceProcessor.Inject(_filter, grid); - - // 2. Allocate handle. - _hnd = grid.HandleRegistry.Allocate(this); - - // 3. Write data to stream. - writer.WriteLong(_hnd); - writer.WriteBoolean(qry.Local); - writer.WriteBoolean(_filter != null); - - var javaFilter = _filter as PlatformJavaObjectFactoryProxy; + ResourceProcessor.Inject(_lsnr, _marsh.Ignite); + ResourceProcessor.Inject(_filter, _marsh.Ignite); - if (javaFilter != null) + try { - writer.WriteObject(javaFilter.GetRawProxy()); - } - else - { - var filterHolder = _filter == null || qry.Local - ? null - : new ContinuousQueryFilterHolder(_filter, _keepBinary); + // 2. Allocate handle. + _hnd = _marsh.Ignite.HandleRegistry.Allocate(this); - writer.WriteObject(filterHolder); + // 3. Call Java. + _nativeQry = createTargetCb(writer => + { + writer.WriteLong(_hnd); + writer.WriteBoolean(qry.Local); + writer.WriteBoolean(_filter != null); + + var javaFilter = _filter as PlatformJavaObjectFactoryProxy; + + if (javaFilter != null) + { + writer.WriteObject(javaFilter.GetRawProxy()); + } + else + { + var filterHolder = _filter == null || qry.Local + ? null + : new ContinuousQueryFilterHolder(_filter, _keepBinary); + + writer.WriteObject(filterHolder); + } + + writer.WriteInt(qry.BufferSize); + writer.WriteLong((long)qry.TimeInterval.TotalMilliseconds); + writer.WriteBoolean(qry.AutoUnsubscribe); + + if (initialQry != null) + { + writer.WriteInt((int)initialQry.OpId); + + initialQry.Write(writer, _keepBinary); + } + else + writer.WriteInt(-1); // no initial query + }); + + // 4. Initial query. + var nativeInitialQryCur = UU.TargetOutObject(_nativeQry, 0); + _initialQueryCursor = nativeInitialQryCur == null + ? null + : new QueryCursor<TK, TV>(nativeInitialQryCur, _marsh, _keepBinary); } + catch (Exception) + { + if (_hnd > 0) + _marsh.Ignite.HandleRegistry.Release(_hnd); - writer.WriteInt(qry.BufferSize); - writer.WriteLong((long)qry.TimeInterval.TotalMilliseconds); - writer.WriteBoolean(qry.AutoUnsubscribe); - - // 4. Call Java. - _nativeQry = cb(); + if (_nativeQry != null) + _nativeQry.Dispose(); - // 5. Initial query. - var nativeInitialQryCur = UU.ContinuousQueryGetInitialQueryCursor(_nativeQry); - _initialQueryCursor = nativeInitialQryCur == null - ? null - : new QueryCursor<TK, TV>(nativeInitialQryCur, _marsh, _keepBinary); + if (_initialQueryCursor != null) + _initialQueryCursor.Dispose(); + + throw; + } } /** <inheritdoc /> */ @@ -208,7 +225,7 @@ namespace Apache.Ignite.Core.Impl.Cache.Query.Continuous try { - UU.ContinuousQueryClose(_nativeQry); + UU.TargetOutLong(_nativeQry, 0); } finally { @@ -219,4 +236,4 @@ namespace Apache.Ignite.Core.Impl.Cache.Query.Continuous } } } -} +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ignite/blob/eaf8ae24/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/Store/CacheStore.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/Store/CacheStore.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/Store/CacheStore.cs index 7785280..b14b2a3 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/Store/CacheStore.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/Store/CacheStore.cs @@ -19,6 +19,7 @@ namespace Apache.Ignite.Core.Impl.Cache.Store { using System.Collections; using System.Diagnostics; + using System.IO; using Apache.Ignite.Core.Binary; using Apache.Ignite.Core.Cache.Store; using Apache.Ignite.Core.Common; @@ -26,7 +27,6 @@ namespace Apache.Ignite.Core.Impl.Cache.Store using Apache.Ignite.Core.Impl.Binary.IO; using Apache.Ignite.Core.Impl.Handle; using Apache.Ignite.Core.Impl.Resource; - using Apache.Ignite.Core.Impl.Unmanaged; /// <summary> /// Interop cache store. @@ -145,21 +145,20 @@ namespace Apache.Ignite.Core.Impl.Cache.Store /// <summary> /// Invokes a store operation. /// </summary> - /// <param name="input">Input stream.</param> - /// <param name="cb">Callback.</param> + /// <param name="stream">Input stream.</param> /// <param name="grid">Grid.</param> /// <returns>Invocation result.</returns> /// <exception cref="IgniteException">Invalid operation type: + opType</exception> - public int Invoke(IBinaryStream input, IUnmanagedTarget cb, Ignite grid) + public int Invoke(IBinaryStream stream, Ignite grid) { - IBinaryReader reader = grid.Marshaller.StartUnmarshal(input, + IBinaryReader reader = grid.Marshaller.StartUnmarshal(stream, _convertBinary ? BinaryMode.Deserialize : BinaryMode.ForceBinary); IBinaryRawReader rawReader = reader.GetRawReader(); int opType = rawReader.ReadByte(); - // Setup cache sessoin for this invocation. + // Setup cache session for this invocation. long sesId = rawReader.ReadLong(); CacheStoreSession ses = grid.HandleRegistry.Get<CacheStoreSession>(sesId, true); @@ -174,27 +173,79 @@ namespace Apache.Ignite.Core.Impl.Cache.Store switch (opType) { case OpLoadCache: - _store.LoadCache((k, v) => WriteObjects(cb, grid, k, v), rawReader.ReadArray<object>()); + { + var args = rawReader.ReadArray<object>(); + + stream.Seek(0, SeekOrigin.Begin); + + int cnt = 0; + stream.WriteInt(cnt); // Reserve space for count. + + var writer = grid.Marshaller.StartMarshal(stream); + + _store.LoadCache((k, v) => + { + lock (writer) // User-defined store can be multithreaded. + { + writer.WithDetach(w => + { + w.WriteObject(k); + w.WriteObject(v); + }); + + cnt++; + } + }, args); + + stream.WriteInt(0, cnt); + + grid.Marshaller.FinishMarshal(writer); break; + } case OpLoad: - object val = _store.Load(rawReader.ReadObject<object>()); + { + var val = _store.Load(rawReader.ReadObject<object>()); + + stream.Seek(0, SeekOrigin.Begin); - if (val != null) - WriteObjects(cb, grid, val); + var writer = grid.Marshaller.StartMarshal(stream); + + writer.WriteObject(val); + + grid.Marshaller.FinishMarshal(writer); break; + } case OpLoadAll: + { var keys = rawReader.ReadCollection(); var result = _store.LoadAll(keys); + stream.Seek(0, SeekOrigin.Begin); + + stream.WriteInt(result.Count); + + var writer = grid.Marshaller.StartMarshal(stream); + foreach (DictionaryEntry entry in result) - WriteObjects(cb, grid, entry.Key, entry.Value); + { + var entry0 = entry; // Copy modified closure. + + writer.WithDetach(w => + { + w.WriteObject(entry0.Key); + w.WriteObject(entry0.Value); + }); + } + + grid.Marshaller.FinishMarshal(writer); break; + } case OpPut: _store.Write(rawReader.ReadObject<object>(), rawReader.ReadObject<object>()); @@ -241,40 +292,5 @@ namespace Apache.Ignite.Core.Impl.Cache.Store _sesProxy.ClearSession(); } } - - /// <summary> - /// Writes objects to the marshaller. - /// </summary> - /// <param name="cb">Optional callback.</param> - /// <param name="grid">Grid.</param> - /// <param name="objects">Objects.</param> - private static void WriteObjects(IUnmanagedTarget cb, Ignite grid, params object[] objects) - { - using (var stream = IgniteManager.Memory.Allocate().GetStream()) - { - BinaryWriter writer = grid.Marshaller.StartMarshal(stream); - - try - { - foreach (var obj in objects) - { - var obj0 = obj; - - writer.WithDetach(w => w.WriteObject(obj0)); - } - } - finally - { - grid.Marshaller.FinishMarshal(writer); - } - - if (cb != null) - { - stream.SynchronizeOutput(); - - UnmanagedUtils.CacheStoreCallbackInvoke(cb, stream.MemoryPointer); - } - } - } } } http://git-wip-us.apache.org/repos/asf/ignite/blob/eaf8ae24/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cluster/ClusterGroupImpl.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cluster/ClusterGroupImpl.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cluster/ClusterGroupImpl.cs index e6c0005..508bdc9 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cluster/ClusterGroupImpl.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cluster/ClusterGroupImpl.cs @@ -99,6 +99,21 @@ namespace Apache.Ignite.Core.Impl.Cluster /** */ private const int OpSchema = 15; + /** */ + private const int OpForRemotes = 17; + + /** */ + private const int OpForRandom = 19; + + /** */ + private const int OpForOldest = 20; + + /** */ + private const int OpForYoungest = 21; + + /** */ + public const int OpResetMetrics = 22; + /** Initial Ignite instance. */ private readonly Ignite _ignite; @@ -208,7 +223,7 @@ namespace Apache.Ignite.Core.Impl.Cluster { Debug.Assert(items != null); - IUnmanagedTarget prj = DoProjetionOutOp(OpForNodeIds, writer => + IUnmanagedTarget prj = DoOutOpObject(OpForNodeIds, writer => { WriteEnumerable(writer, items, func); }); @@ -229,11 +244,12 @@ namespace Apache.Ignite.Core.Impl.Cluster { IgniteArgumentCheck.NotNull(name, "name"); - IUnmanagedTarget prj = DoProjetionOutOp(OpForAttribute, writer => + Action<BinaryWriter> action = writer => { writer.WriteString(name); writer.WriteString(val); - }); + }; + IUnmanagedTarget prj = DoOutOpObject(OpForAttribute, action); return GetClusterGroup(prj); } @@ -248,7 +264,7 @@ namespace Apache.Ignite.Core.Impl.Cluster /// </returns> private IClusterGroup ForCacheNodes(string name, int op) { - IUnmanagedTarget prj = DoProjetionOutOp(op, writer => + IUnmanagedTarget prj = DoOutOpObject(op, writer => { writer.WriteString(name); }); @@ -277,7 +293,7 @@ namespace Apache.Ignite.Core.Impl.Cluster /** <inheritDoc /> */ public IClusterGroup ForRemotes() { - return GetClusterGroup(UU.ProjectionForRemotes(Target)); + return GetClusterGroup(DoOutOpObject(OpForRemotes)); } /** <inheritDoc /> */ @@ -285,7 +301,7 @@ namespace Apache.Ignite.Core.Impl.Cluster { IgniteArgumentCheck.NotNull(node, "node"); - IUnmanagedTarget prj = DoProjetionOutOp(OpForHost, writer => + IUnmanagedTarget prj = DoOutOpObject(OpForHost, writer => { writer.WriteGuid(node.Id); }); @@ -296,19 +312,19 @@ namespace Apache.Ignite.Core.Impl.Cluster /** <inheritDoc /> */ public IClusterGroup ForRandom() { - return GetClusterGroup(UU.ProjectionForRandom(Target)); + return GetClusterGroup(DoOutOpObject(OpForRandom)); } /** <inheritDoc /> */ public IClusterGroup ForOldest() { - return GetClusterGroup(UU.ProjectionForOldest(Target)); + return GetClusterGroup(DoOutOpObject(OpForOldest)); } /** <inheritDoc /> */ public IClusterGroup ForYoungest() { - return GetClusterGroup(UU.ProjectionForYoungest(Target)); + return GetClusterGroup(DoOutOpObject(OpForYoungest)); } /** <inheritDoc /> */ @@ -519,27 +535,7 @@ namespace Apache.Ignite.Core.Impl.Cluster return _nodes; } - - /// <summary> - /// Perform synchronous out operation returning value. - /// </summary> - /// <param name="type">Operation type.</param> - /// <param name="action">Action.</param> - /// <returns>Native projection.</returns> - private IUnmanagedTarget DoProjetionOutOp(int type, Action<BinaryWriter> action) - { - using (var stream = IgniteManager.Memory.Allocate().GetStream()) - { - var writer = Marshaller.StartMarshal(stream); - action(writer); - - FinishMarshal(writer); - - return UU.ProjectionOutOpRet(Target, type, stream.SynchronizeOutput()); - } - } - /** <inheritDoc /> */ public IBinaryType GetBinaryType(int typeId) { http://git-wip-us.apache.org/repos/asf/ignite/blob/eaf8ae24/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Common/Future.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Common/Future.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Common/Future.cs index 746577a..68bd9d4 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Common/Future.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Common/Future.cs @@ -62,7 +62,10 @@ namespace Apache.Ignite.Core.Impl.Common } catch (AggregateException ex) { - throw ex.InnerException; + if (ex.InnerException != null) + throw ex.InnerException; + + throw; } } @@ -174,33 +177,12 @@ namespace Apache.Ignite.Core.Impl.Common } /// <summary> - /// Cancels this instance. - /// </summary> - internal bool Cancel() - { - if (_unmanagedTarget == null) - return false; - - return UnmanagedUtils.ListenableCancel(_unmanagedTarget); - } - - /// <summary> - /// Determines whether this instance is cancelled. - /// </summary> - internal bool IsCancelled() - { - if (_unmanagedTarget == null) - return false; - - return UnmanagedUtils.ListenableIsCancelled(_unmanagedTarget); - } - - /// <summary> /// Called when token cancellation occurs. /// </summary> private void OnTokenCancel() { - Cancel(); + if (_unmanagedTarget != null) + UnmanagedUtils.ListenableCancel(_unmanagedTarget); } } } http://git-wip-us.apache.org/repos/asf/ignite/blob/eaf8ae24/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Compute/ComputeImpl.cs ---------------------------------------------------------------------- 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 86dee30..1b2e2aa 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Compute/ComputeImpl.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Compute/ComputeImpl.cs @@ -57,6 +57,15 @@ namespace Apache.Ignite.Core.Impl.Compute /** */ private const int OpUnicast = 5; + /** */ + private const int OpWithNoFailover = 6; + + /** */ + private const int OpWithTimeout = 7; + + /** */ + private const int OpExecNative = 8; + /** Underlying projection. */ private readonly ClusterGroupImpl _prj; @@ -97,7 +106,7 @@ namespace Apache.Ignite.Core.Impl.Compute /// </summary> public void WithNoFailover() { - UU.ComputeWithNoFailover(Target); + DoOutOp(OpWithNoFailover); } /// <summary> @@ -107,7 +116,7 @@ namespace Apache.Ignite.Core.Impl.Compute /// <param name="timeout">Computation timeout in milliseconds.</param> public void WithTimeout(long timeout) { - UU.ComputeWithTimeout(Target, timeout); + DoOutInOpLong(OpWithTimeout, timeout); } /// <summary> @@ -193,7 +202,11 @@ namespace Apache.Ignite.Core.Impl.Compute long ptr = Marshaller.Ignite.HandleRegistry.Allocate(holder); - var futTarget = UU.ComputeExecuteNative(Target, ptr, _prj.TopologyVersion); + var futTarget = DoOutOpObject(OpExecNative, w => + { + w.WriteLong(ptr); + w.WriteLong(_prj.TopologyVersion); + }); var future = holder.Future; http://git-wip-us.apache.org/repos/asf/ignite/blob/eaf8ae24/modules/platforms/dotnet/Apache.Ignite.Core/Impl/DataStructures/AtomicLong.cs ---------------------------------------------------------------------- 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 6fefe3b..571e6fd 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/DataStructures/AtomicLong.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/DataStructures/AtomicLong.cs @@ -20,6 +20,7 @@ namespace Apache.Ignite.Core.Impl.DataStructures using System.Diagnostics; using Apache.Ignite.Core.DataStructures; using Apache.Ignite.Core.Impl.Binary; + using Apache.Ignite.Core.Impl.Binary.IO; using Apache.Ignite.Core.Impl.Unmanaged; using UU = Apache.Ignite.Core.Impl.Unmanaged.UnmanagedUtils; @@ -32,6 +33,19 @@ namespace Apache.Ignite.Core.Impl.DataStructures /** */ private readonly string _name; + /** Operation codes. */ + private enum Op + { + AddAndGet = 1, + Close = 2, + CompareAndSetAndGet = 4, + DecrementAndGet = 5, + Get = 6, + GetAndSet = 10, + IncrementAndGet = 11, + IsClosed = 12 + } + /// <summary> /// Initializes a new instance of the <see cref="AtomicLong"/> class. /// </summary> @@ -54,49 +68,53 @@ namespace Apache.Ignite.Core.Impl.DataStructures /** <inheritDoc /> */ public long Read() { - return UU.AtomicLongGet(Target); + return DoOutOp((int) Op.Get); } /** <inheritDoc /> */ public long Increment() { - return UU.AtomicLongIncrementAndGet(Target); + return DoOutOp((int) Op.IncrementAndGet); } /** <inheritDoc /> */ public long Add(long value) { - return UU.AtomicLongAddAndGet(Target, value); + return DoOutInOpLong((int) Op.AddAndGet, value); } /** <inheritDoc /> */ public long Decrement() { - return UU.AtomicLongDecrementAndGet(Target); + return DoOutOp((int) Op.DecrementAndGet); } /** <inheritDoc /> */ public long Exchange(long value) { - return UU.AtomicLongGetAndSet(Target, value); + return DoOutInOpLong((int) Op.GetAndSet, value); } /** <inheritDoc /> */ public long CompareExchange(long value, long comparand) { - return UU.AtomicLongCompareAndSetAndGet(Target, comparand, value); + return DoOutOp((int) Op.CompareAndSetAndGet, (IBinaryStream s) => + { + s.WriteLong(comparand); + s.WriteLong(value); + }); } /** <inheritDoc /> */ public void Close() { - UU.AtomicLongClose(Target); + DoOutOp((int) Op.Close); } /** <inheritDoc /> */ public bool IsClosed() { - return UU.AtomicLongIsClosed(Target); + return DoOutOp((int) Op.IsClosed) == True; } } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ignite/blob/eaf8ae24/modules/platforms/dotnet/Apache.Ignite.Core/Impl/DataStructures/AtomicReference.cs ---------------------------------------------------------------------- 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 d22afeb..75e36d1 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/DataStructures/AtomicReference.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/DataStructures/AtomicReference.cs @@ -32,7 +32,9 @@ namespace Apache.Ignite.Core.Impl.DataStructures { Get = 1, Set = 2, - CompareAndSetAndGet = 3 + CompareAndSetAndGet = 3, + Close = 4, + IsClosed = 5 } /** */ @@ -80,13 +82,13 @@ namespace Apache.Ignite.Core.Impl.DataStructures /** <inheritDoc /> */ public bool IsClosed { - get { return UnmanagedUtils.AtomicReferenceIsClosed(Target); } + get { return DoOutOp((int) Op.IsClosed) == True; } } /** <inheritDoc /> */ public void Close() { - UnmanagedUtils.AtomicReferenceClose(Target); + DoOutOp((int) Op.Close); } } } http://git-wip-us.apache.org/repos/asf/ignite/blob/eaf8ae24/modules/platforms/dotnet/Apache.Ignite.Core/Impl/DataStructures/AtomicSequence.cs ---------------------------------------------------------------------- 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 0835b9a..b7b924e 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/DataStructures/AtomicSequence.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/DataStructures/AtomicSequence.cs @@ -30,6 +30,18 @@ namespace Apache.Ignite.Core.Impl.DataStructures /** */ private readonly string _name; + /** */ + private enum Op + { + AddAndGet = 1, + Close = 2, + Get = 3, + GetBatchSize = 6, + IncrementAndGet = 7, + IsClosed = 8, + SetBatchSize = 9 + } + /// <summary> /// Initializes a new instance of the <see cref="Apache.Ignite.Core.Impl.DataStructures.AtomicLong"/> class. /// </summary> @@ -53,38 +65,38 @@ namespace Apache.Ignite.Core.Impl.DataStructures /** <inheritDoc /> */ public long Read() { - return UnmanagedUtils.AtomicSequenceGet(Target); + return DoOutOp((int) Op.Get); } /** <inheritDoc /> */ public long Increment() { - return UnmanagedUtils.AtomicSequenceIncrementAndGet(Target); + return DoOutOp((int) Op.IncrementAndGet); } /** <inheritDoc /> */ public long Add(long value) { - return UnmanagedUtils.AtomicSequenceAddAndGet(Target, value); + return DoOutInOpLong((int) Op.AddAndGet, value); } /** <inheritDoc /> */ public int BatchSize { - get { return UnmanagedUtils.AtomicSequenceGetBatchSize(Target); } - set { UnmanagedUtils.AtomicSequenceSetBatchSize(Target, value); } + get { return (int) DoOutOp((int) Op.GetBatchSize); } + set { DoOutInOpLong((int) Op.SetBatchSize, value); } } /** <inheritDoc /> */ public bool IsClosed { - get { return UnmanagedUtils.AtomicSequenceIsClosed(Target); } + get { return DoOutOp((int) Op.IsClosed) == True; } } /** <inheritDoc /> */ public void Close() { - UnmanagedUtils.AtomicSequenceClose(Target); + DoOutOp((int) Op.Close); } } } http://git-wip-us.apache.org/repos/asf/ignite/blob/eaf8ae24/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Datastream/DataStreamerImpl.cs ---------------------------------------------------------------------- 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 74261d3..8893fc5 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Datastream/DataStreamerImpl.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Datastream/DataStreamerImpl.cs @@ -67,7 +67,34 @@ namespace Apache.Ignite.Core.Impl.Datastream /** Operation: set receiver. */ private const int OpReceiver = 2; - + + /** */ + private const int OpAllowOverwrite = 3; + + /** */ + private const int OpSetAllowOverwrite = 4; + + /** */ + private const int OpSkipStore = 5; + + /** */ + private const int OpSetSkipStore = 6; + + /** */ + private const int OpPerNodeBufferSize = 7; + + /** */ + private const int OpSetPerNodeBufferSize = 8; + + /** */ + private const int OpPerNodeParallelOps = 9; + + /** */ + private const int OpSetPerNodeParallelOps = 10; + + /** */ + private const int OpListenTopology = 11; + /** Cache name. */ private readonly string _cacheName; @@ -129,7 +156,7 @@ namespace Apache.Ignite.Core.Impl.Datastream _hnd = marsh.Ignite.HandleRegistry.Allocate(thisRef); // Start topology listening. This call will ensure that buffer size member is updated. - UU.DataStreamerListenTopology(target, _hnd); + DoOutInOpLong(OpListenTopology, _hnd); // Membar to ensure fields initialization before leaving constructor. Thread.MemoryBarrier(); @@ -157,7 +184,7 @@ namespace Apache.Ignite.Core.Impl.Datastream { ThrowIfDisposed(); - return UU.DataStreamerAllowOverwriteGet(Target); + return DoOutOp(OpAllowOverwrite) == True; } finally { @@ -172,7 +199,7 @@ namespace Apache.Ignite.Core.Impl.Datastream { ThrowIfDisposed(); - UU.DataStreamerAllowOverwriteSet(Target, value); + DoOutInOpLong(OpSetAllowOverwrite, value ? True : False); } finally { @@ -192,7 +219,7 @@ namespace Apache.Ignite.Core.Impl.Datastream { ThrowIfDisposed(); - return UU.DataStreamerSkipStoreGet(Target); + return DoOutOp(OpSkipStore) == True; } finally { @@ -207,7 +234,7 @@ namespace Apache.Ignite.Core.Impl.Datastream { ThrowIfDisposed(); - UU.DataStreamerSkipStoreSet(Target, value); + DoOutInOpLong(OpSetSkipStore, value ? True : False); } finally { @@ -227,7 +254,7 @@ namespace Apache.Ignite.Core.Impl.Datastream { ThrowIfDisposed(); - return UU.DataStreamerPerNodeBufferSizeGet(Target); + return (int) DoOutOp(OpPerNodeBufferSize); } finally { @@ -242,7 +269,7 @@ namespace Apache.Ignite.Core.Impl.Datastream { ThrowIfDisposed(); - UU.DataStreamerPerNodeBufferSizeSet(Target, value); + DoOutInOpLong(OpSetPerNodeBufferSize, value); _bufSndSize = _topSize * value; } @@ -264,7 +291,7 @@ namespace Apache.Ignite.Core.Impl.Datastream { ThrowIfDisposed(); - return UU.DataStreamerPerNodeParallelOperationsGet(Target); + return (int) DoOutOp(OpPerNodeParallelOps); } finally { @@ -280,7 +307,7 @@ namespace Apache.Ignite.Core.Impl.Datastream { ThrowIfDisposed(); - UU.DataStreamerPerNodeParallelOperationsSet(Target, value); + DoOutInOpLong(OpSetPerNodeParallelOps, value); } finally { @@ -571,7 +598,7 @@ namespace Apache.Ignite.Core.Impl.Datastream _topVer = topVer; _topSize = topSize > 0 ? topSize : 1; // Do not set to 0 to avoid 0 buffer size. - _bufSndSize = _topSize * UU.DataStreamerPerNodeBufferSizeGet(Target); + _bufSndSize = (int) (_topSize * DoOutOp(OpPerNodeBufferSize)); } } finally http://git-wip-us.apache.org/repos/asf/ignite/blob/eaf8ae24/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Events/Events.cs ---------------------------------------------------------------------- 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 783ba94..5d1add640 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Events/Events.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Events/Events.cs @@ -52,7 +52,11 @@ namespace Apache.Ignite.Core.Impl.Events RecordLocal = 6, EnableLocal = 8, DisableLocal = 9, - GetEnabledEvents = 10 + GetEnabledEvents = 10, + WithAsync = 11, + IsEnabled = 12, + LocalListen = 13, + StopLocalListen = 14 } /** Map from user func to local wrapper, needed for invoke/unsubscribe. */ @@ -85,7 +89,7 @@ namespace Apache.Ignite.Core.Impl.Events /// Initializes a new async instance. /// </summary> /// <param name="events">The events.</param> - private Events(Events events) : base(UU.EventsWithAsync(events.Target), events.Marshaller) + private Events(Events events) : base(UU.TargetOutObject(events.Target, (int) Op.WithAsync), events.Marshaller) { _clusterGroup = events.ClusterGroup; } @@ -335,7 +339,7 @@ namespace Apache.Ignite.Core.Impl.Events // 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 |= UU.EventsStopLocalListen(Target, filter.Handle); + success |= (DoOutInOpLong((int) Op.StopLocalListen, filter.Handle) == True); return success; } @@ -384,7 +388,7 @@ namespace Apache.Ignite.Core.Impl.Events /** <inheritDoc /> */ public bool IsEnabled(int type) { - return UU.EventsIsEnabled(Target, type); + return DoOutInOpLong((int) Op.IsEnabled, type) == True; } /// <summary> @@ -508,7 +512,11 @@ namespace Apache.Ignite.Core.Impl.Events filters[type] = localFilter; } - UU.EventsLocalListen(Target, localFilter.Handle, type); + DoOutOp((int) Op.LocalListen, (IBinaryStream s) => + { + s.WriteLong(localFilter.Handle); + s.WriteInt(type); + }); } } http://git-wip-us.apache.org/repos/asf/ignite/blob/eaf8ae24/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Ignite.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Ignite.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Ignite.cs index 0706966..675af5e 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 @@ namespace Apache.Ignite.Core.Impl /** <inheritdoc /> */ public void ResetMetrics() { - UU.ProjectionResetMetrics(_prj.Target); + UU.TargetOutLong(_prj.Target, ClusterGroupImpl.OpResetMetrics); } /** <inheritdoc /> */ http://git-wip-us.apache.org/repos/asf/ignite/blob/eaf8ae24/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Messaging/Messaging.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Messaging/Messaging.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Messaging/Messaging.cs index 5882495..2216d1a 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Messaging/Messaging.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Messaging/Messaging.cs @@ -48,7 +48,8 @@ namespace Apache.Ignite.Core.Impl.Messaging SendMulti = 4, SendOrdered = 5, StopLocalListen = 6, - StopRemoteListen = 7 + StopRemoteListen = 7, + WithAsync = 8 } /** Map from user (func+topic) -> id, needed for unsubscription. */ @@ -89,7 +90,8 @@ namespace Apache.Ignite.Core.Impl.Messaging /// Initializes a new async instance. /// </summary> /// <param name="messaging">The messaging.</param> - private Messaging(Messaging messaging) : base(UU.MessagingWithASync(messaging.Target), messaging.Marshaller) + private Messaging(Messaging messaging) : base( + UU.TargetOutObject(messaging.Target, (int) Op.WithAsync), messaging.Marshaller) { _isAsync = true; _ignite = messaging._ignite; http://git-wip-us.apache.org/repos/asf/ignite/blob/eaf8ae24/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 26b6033..8c065bc 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/PlatformTarget.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/PlatformTarget.cs @@ -40,6 +40,9 @@ namespace Apache.Ignite.Core.Impl internal abstract class PlatformTarget { /** */ + protected const int False = 0; + + /** */ protected const int True = 1; /** */ @@ -256,6 +259,16 @@ namespace Apache.Ignite.Core.Impl /// Perform out operation. /// </summary> /// <param name="type">Operation type.</param> + /// <returns>Long result.</returns> + protected long DoOutOp(int type) + { + return UU.TargetOutLong(_target, type); + } + + /// <summary> + /// Perform out operation. + /// </summary> + /// <param name="type">Operation type.</param> /// <param name="action">Action to be performed on the stream.</param> /// <returns></returns> protected long DoOutOp(int type, Action<IBinaryStream> action) @@ -309,6 +322,16 @@ namespace Apache.Ignite.Core.Impl } /// <summary> + /// Perform out operation. + /// </summary> + /// <param name="type">Operation type.</param> + /// <returns>Resulting object.</returns> + protected IUnmanagedTarget DoOutOpObject(int type) + { + return UU.TargetOutObject(_target, type); + } + + /// <summary> /// Perform simple output operation accepting single argument. /// </summary> /// <param name="type">Operation type.</param> @@ -505,6 +528,66 @@ namespace Apache.Ignite.Core.Impl /// </summary> /// <param name="type">Operation type.</param> /// <param name="outAction">Out action.</param> + /// <param name="inAction">In action.</param> + /// <param name="arg">Argument.</param> + /// <returns>Result.</returns> + protected unsafe TR DoOutInOp<TR>(int type, Action<BinaryWriter> outAction, + Func<IBinaryStream, IUnmanagedTarget, TR> inAction, void* arg) + { + PlatformMemoryStream outStream = null; + long outPtr = 0; + + PlatformMemoryStream inStream = null; + long inPtr = 0; + + try + { + if (outAction != null) + { + outStream = IgniteManager.Memory.Allocate().GetStream(); + var writer = _marsh.StartMarshal(outStream); + outAction(writer); + FinishMarshal(writer); + outPtr = outStream.SynchronizeOutput(); + } + + if (inAction != null) + { + inStream = IgniteManager.Memory.Allocate().GetStream(); + inPtr = inStream.MemoryPointer; + } + + var res = UU.TargetInObjectStreamOutObjectStream(_target, type, arg, outPtr, inPtr); + + if (inAction == null) + return default(TR); + + inStream.SynchronizeInput(); + + return inAction(inStream, res); + + } + finally + { + try + { + if (inStream != null) + inStream.Dispose(); + + } + finally + { + if (outStream != null) + outStream.Dispose(); + } + } + } + + /// <summary> + /// Perform out-in operation. + /// </summary> + /// <param name="type">Operation type.</param> + /// <param name="outAction">Out action.</param> /// <returns>Result.</returns> protected TR DoOutInOp<TR>(int type, Action<BinaryWriter> outAction) { @@ -583,6 +666,17 @@ namespace Apache.Ignite.Core.Impl } } + /// <summary> + /// Perform simple out-in operation accepting two arguments. + /// </summary> + /// <param name="type">Operation type.</param> + /// <param name="val">Value.</param> + /// <returns>Result.</returns> + protected long DoOutInOpLong(int type, long val) + { + return UU.TargetInLongOutLong(_target, type, val); + } + #endregion #region Miscelanneous http://git-wip-us.apache.org/repos/asf/ignite/blob/eaf8ae24/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Services/Services.cs ---------------------------------------------------------------------- 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 3d55f06..d6b1d05 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Services/Services.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Services/Services.cs @@ -51,6 +51,21 @@ namespace Apache.Ignite.Core.Impl.Services private const int OpDescriptors = 5; /** */ + private const int OpWithAsync = 6; + + /** */ + private const int OpWithServerKeepBinary = 7; + + /** */ + private const int OpServiceProxy = 8; + + /** */ + private const int OpCancel = 9; + + /** */ + private const int OpCancelAll = 10; + + /** */ private readonly IClusterGroup _clusterGroup; /** Invoker binary flag. */ @@ -87,7 +102,8 @@ namespace Apache.Ignite.Core.Impl.Services /// Initializes a new async instance. /// </summary> /// <param name="services">The services.</param> - private Services(Services services) : base(UU.ServicesWithAsync(services.Target), services.Marshaller) + private Services(Services services) : base(UU.TargetOutObject(services.Target, OpWithAsync), + services.Marshaller) { _clusterGroup = services.ClusterGroup; _keepBinary = services._keepBinary; @@ -109,7 +125,7 @@ namespace Apache.Ignite.Core.Impl.Services if (_srvKeepBinary) return this; - return new Services(UU.ServicesWithServerKeepBinary(Target), Marshaller, _clusterGroup, _keepBinary, true); + return new Services(DoOutOpObject(OpWithServerKeepBinary), Marshaller, _clusterGroup, _keepBinary, true); } /** <inheritDoc /> */ @@ -243,7 +259,7 @@ namespace Apache.Ignite.Core.Impl.Services { IgniteArgumentCheck.NotNullOrEmpty(name, "name"); - UU.ServicesCancel(Target, name); + DoOutOp(OpCancel, w => w.WriteString(name)); } /** <inheritDoc /> */ @@ -257,7 +273,7 @@ namespace Apache.Ignite.Core.Impl.Services /** <inheritDoc /> */ public void CancelAll() { - UU.ServicesCancelAll(Target); + DoOutOp(OpCancelAll); } /** <inheritDoc /> */ @@ -347,7 +363,12 @@ namespace Apache.Ignite.Core.Impl.Services if (locInst != null) return locInst; - var javaProxy = UU.ServicesGetServiceProxy(Target, name, sticky); + var javaProxy = DoOutOpObject(OpServiceProxy, w => + { + w.WriteString(name); + w.WriteBoolean(sticky); + }); + var platform = GetServiceDescriptors().Cast<ServiceDescriptor>().Single(x => x.Name == name).Platform; return new ServiceProxy<T>((method, args) => http://git-wip-us.apache.org/repos/asf/ignite/blob/eaf8ae24/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Transactions/TransactionsImpl.cs ---------------------------------------------------------------------- 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 51a49d0..796044d 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Transactions/TransactionsImpl.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Transactions/TransactionsImpl.cs @@ -22,9 +22,9 @@ namespace Apache.Ignite.Core.Impl.Transactions using System.Threading.Tasks; using Apache.Ignite.Core.Binary; using Apache.Ignite.Core.Impl.Binary; + using Apache.Ignite.Core.Impl.Binary.IO; using Apache.Ignite.Core.Impl.Unmanaged; using Apache.Ignite.Core.Transactions; - using UU = Apache.Ignite.Core.Impl.Unmanaged.UnmanagedUtils; /// <summary> /// Transactions facade. @@ -36,7 +36,35 @@ namespace Apache.Ignite.Core.Impl.Transactions /** */ private const int OpMetrics = 2; - + + /** */ + private const int OpStart = 3; + + /** */ + private const int OpCommit = 4; + + /** */ + private const int OpRollback = 5; + + /** */ + private const int OpClose = 6; + + /** */ + private const int OpState = 7; + + /** */ + private const int OpSetRollbackOnly = 8; + + /** */ + private const int OpCommitAsync = 9; + + /** */ + private const int OpRollbackAsync = 10; + + /** */ + private const int OpResetMetrics = 11; + + /** */ private readonly TransactionConcurrency _dfltConcurrency; @@ -95,8 +123,13 @@ namespace Apache.Ignite.Core.Impl.Transactions public ITransaction TxStart(TransactionConcurrency concurrency, TransactionIsolation isolation, TimeSpan timeout, int txSize) { - var id = UU.TransactionsStart(Target, (int)concurrency, (int)isolation, (long)timeout.TotalMilliseconds, - txSize); + var id = DoOutInOp(OpStart, w => + { + w.WriteInt((int) concurrency); + w.WriteInt((int) isolation); + w.WriteTimeSpanAsLong(timeout); + w.WriteInt(txSize); + }, s => s.ReadLong()); var innerTx = new TransactionImpl(id, this, concurrency, isolation, timeout, _localNodeId); @@ -123,7 +156,7 @@ namespace Apache.Ignite.Core.Impl.Transactions /** <inheritDoc /> */ public void ResetMetrics() { - UU.TransactionsResetMetrics(Target); + DoOutOp(OpResetMetrics); } /// <summary> @@ -133,7 +166,7 @@ namespace Apache.Ignite.Core.Impl.Transactions /// <returns>Final transaction state.</returns> internal TransactionState TxCommit(TransactionImpl tx) { - return (TransactionState) UU.TransactionsCommit(Target, tx.Id); + return (TransactionState) DoOutInOpLong(OpCommit, tx.Id); } /// <summary> @@ -143,7 +176,7 @@ namespace Apache.Ignite.Core.Impl.Transactions /// <returns>Final transaction state.</returns> internal TransactionState TxRollback(TransactionImpl tx) { - return (TransactionState)UU.TransactionsRollback(Target, tx.Id); + return (TransactionState) DoOutInOpLong(OpRollback, tx.Id); } /// <summary> @@ -153,7 +186,7 @@ namespace Apache.Ignite.Core.Impl.Transactions /// <returns>Final transaction state.</returns> internal int TxClose(TransactionImpl tx) { - return UU.TransactionsClose(Target, tx.Id); + return (int) DoOutInOpLong(OpClose, tx.Id); } /// <summary> @@ -163,7 +196,7 @@ namespace Apache.Ignite.Core.Impl.Transactions /// <returns>Transaction current state.</returns> internal TransactionState TxState(TransactionImpl tx) { - return GetTransactionState(UU.TransactionsState(Target, tx.Id)); + return (TransactionState) DoOutInOpLong(OpState, tx.Id); } /// <summary> @@ -173,7 +206,7 @@ namespace Apache.Ignite.Core.Impl.Transactions /// <returns><c>true</c> if the flag was set.</returns> internal bool TxSetRollbackOnly(TransactionImpl tx) { - return UU.TransactionsSetRollbackOnly(Target, tx.Id); + return DoOutInOpLong(OpSetRollbackOnly, tx.Id) == True; } /// <summary> @@ -181,7 +214,11 @@ namespace Apache.Ignite.Core.Impl.Transactions /// </summary> internal Task CommitAsync(TransactionImpl tx) { - return GetFuture<object>((futId, futTyp) => UU.TransactionsCommitAsync(Target, tx.Id, futId)).Task; + return GetFuture<object>((futId, futTyp) => DoOutOp(OpCommitAsync, (IBinaryStream s) => + { + s.WriteLong(tx.Id); + s.WriteLong(futId); + })).Task; } /// <summary> @@ -189,15 +226,11 @@ namespace Apache.Ignite.Core.Impl.Transactions /// </summary> internal Task RollbackAsync(TransactionImpl tx) { - return GetFuture<object>((futId, futTyp) => UU.TransactionsRollbackAsync(Target, tx.Id, futId)).Task; - } - - /// <summary> - /// Gets the state of the transaction from int. - /// </summary> - private static TransactionState GetTransactionState(int state) - { - return (TransactionState)state; + return GetFuture<object>((futId, futTyp) => DoOutOp(OpRollbackAsync, (IBinaryStream s) => + { + s.WriteLong(tx.Id); + s.WriteLong(futId); + })).Task; } } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ignite/blob/eaf8ae24/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 bb26382..8de82ee 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Unmanaged/IgniteJniNativeMethods.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Unmanaged/IgniteJniNativeMethods.cs @@ -113,6 +113,9 @@ namespace Apache.Ignite.Core.Impl.Unmanaged [DllImport(IgniteUtils.FileIgniteJniDll, EntryPoint = "IgniteProcessorGetCacheNames")] public static extern void ProcessorGetCacheNames(void* ctx, void* obj, long memPtr); + [DllImport(IgniteUtils.FileIgniteJniDll, EntryPoint = "IgniteTargetInLongOutLong")] + public static extern long TargetInLongOutLong(void* ctx, void* target, int opType, long val); + [DllImport(IgniteUtils.FileIgniteJniDll, EntryPoint = "IgniteTargetInStreamOutLong")] public static extern long TargetInStreamOutLong(void* ctx, void* target, int opType, long memPtr); @@ -127,6 +130,10 @@ namespace Apache.Ignite.Core.Impl.Unmanaged public static extern void TargetInObjectStreamOutStream(void* ctx, void* target, int opType, void* arg, long inMemPtr, long outMemPtr); + [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); @@ -148,178 +155,12 @@ namespace Apache.Ignite.Core.Impl.Unmanaged [DllImport(IgniteUtils.FileIgniteJniDll, EntryPoint = "IgniteTargetListenFutureForOperationAndGet")] public static extern void* TargetListenFutForOpAndGet(void* ctx, void* target, long futId, int typ, int opId); - [DllImport(IgniteUtils.FileIgniteJniDll, EntryPoint = "IgniteAffinityPartitions")] - public static extern int AffinityParts(void* ctx, void* target); - - [DllImport(IgniteUtils.FileIgniteJniDll, EntryPoint = "IgniteCacheWithSkipStore")] - public static extern void* CacheWithSkipStore(void* ctx, void* obj); - - [DllImport(IgniteUtils.FileIgniteJniDll, EntryPoint = "IgniteCacheWithNoRetries")] - public static extern void* CacheWithNoRetries(void* ctx, void* obj); - - [DllImport(IgniteUtils.FileIgniteJniDll, EntryPoint = "IgniteCacheWithExpiryPolicy")] - public static extern void* CacheWithExpiryPolicy(void* ctx, void* obj, long create, long update, long access); - - [DllImport(IgniteUtils.FileIgniteJniDll, EntryPoint = "IgniteCacheWithAsync")] - public static extern void* CacheWithAsync(void* ctx, void* obj); - - [DllImport(IgniteUtils.FileIgniteJniDll, EntryPoint = "IgniteCacheWithKeepPortable")] - public static extern void* CacheWithKeepBinary(void* ctx, void* obj); - - [DllImport(IgniteUtils.FileIgniteJniDll, EntryPoint = "IgniteCacheClear")] - public static extern void CacheClear(void* ctx, void* obj); - - [DllImport(IgniteUtils.FileIgniteJniDll, EntryPoint = "IgniteCacheRemoveAll")] - public static extern void CacheRemoveAll(void* ctx, void* obj); - - [DllImport(IgniteUtils.FileIgniteJniDll, EntryPoint = "IgniteCacheOutOpQueryCursor")] - public static extern void* CacheOutOpQueryCursor(void* ctx, void* obj, int type, long memPtr); - - [DllImport(IgniteUtils.FileIgniteJniDll, EntryPoint = "IgniteCacheOutOpContinuousQuery")] - public static extern void* CacheOutOpContinuousQuery(void* ctx, void* obj, int type, long memPtr); - - [DllImport(IgniteUtils.FileIgniteJniDll, EntryPoint = "IgniteCacheIterator")] - public static extern void* CacheIterator(void* ctx, void* obj); - - [DllImport(IgniteUtils.FileIgniteJniDll, EntryPoint = "IgniteCacheLocalIterator")] - public static extern void* CacheLocalIterator(void* ctx, void* obj, int peekModes); - - [DllImport(IgniteUtils.FileIgniteJniDll, EntryPoint = "IgniteCacheEnterLock")] - public static extern void CacheEnterLock(void* ctx, void* obj, long id); - - [DllImport(IgniteUtils.FileIgniteJniDll, EntryPoint = "IgniteCacheExitLock")] - public static extern void CacheExitLock(void* ctx, void* obj, long id); - - [DllImport(IgniteUtils.FileIgniteJniDll, EntryPoint = "IgniteCacheTryEnterLock")] - [return: MarshalAs(UnmanagedType.U1)] - public static extern bool CacheTryEnterLock(void* ctx, void* obj, long id, long timeout); - - [DllImport(IgniteUtils.FileIgniteJniDll, EntryPoint = "IgniteCacheCloseLock")] - public static extern void CacheCloseLock(void* ctx, void* obj, long id); - - [DllImport(IgniteUtils.FileIgniteJniDll, EntryPoint = "IgniteCacheRebalance")] - public static extern void CacheRebalance(void* ctx, void* obj, long futId); - - [DllImport(IgniteUtils.FileIgniteJniDll, EntryPoint = "IgniteCacheSize")] - public static extern int CacheSize(void* ctx, void* obj, int peekModes, [MarshalAs(UnmanagedType.U1)] bool loc); - - [DllImport(IgniteUtils.FileIgniteJniDll, EntryPoint = "IgniteCacheStoreCallbackInvoke")] - public static extern void CacheStoreCallbackInvoke(void* ctx, void* obj, long memPtr); - - [DllImport(IgniteUtils.FileIgniteJniDll, EntryPoint = "IgniteComputeWithNoFailover")] - public static extern void ComputeWithNoFailover(void* ctx, void* target); - - [DllImport(IgniteUtils.FileIgniteJniDll, EntryPoint = "IgniteComputeWithTimeout")] - public static extern void ComputeWithTimeout(void* ctx, void* target, long timeout); - - [DllImport(IgniteUtils.FileIgniteJniDll, EntryPoint = "IgniteComputeExecuteNative")] - public static extern void* ComputeExecuteNative(void* ctx, void* target, long taskPtr, long topVer); - - [DllImport(IgniteUtils.FileIgniteJniDll, EntryPoint = "IgniteContinuousQueryClose")] - public static extern void ContinuousQryClose(void* ctx, void* target); - - [DllImport(IgniteUtils.FileIgniteJniDll, EntryPoint = "IgniteContinuousQueryGetInitialQueryCursor")] - public static extern void* ContinuousQryGetInitialQueryCursor(void* ctx, void* target); - - [DllImport(IgniteUtils.FileIgniteJniDll, EntryPoint = "IgniteDataStreamerListenTopology")] - public static extern void DataStreamerListenTop(void* ctx, void* obj, long ptr); - - [DllImport(IgniteUtils.FileIgniteJniDll, EntryPoint = "IgniteDataStreamerAllowOverwriteGet")] - [return: MarshalAs(UnmanagedType.U1)] - public static extern bool DataStreamerAllowOverwriteGet(void* ctx, void* obj); - - [DllImport(IgniteUtils.FileIgniteJniDll, EntryPoint = "IgniteDataStreamerAllowOverwriteSet")] - public static extern void DataStreamerAllowOverwriteSet(void* ctx, void* obj, - [MarshalAs(UnmanagedType.U1)] bool val); - - [DllImport(IgniteUtils.FileIgniteJniDll, EntryPoint = "IgniteDataStreamerSkipStoreGet")] - [return: MarshalAs(UnmanagedType.U1)] - public static extern bool DataStreamerSkipStoreGet(void* ctx, void* obj); - - [DllImport(IgniteUtils.FileIgniteJniDll, EntryPoint = "IgniteDataStreamerSkipStoreSet")] - public static extern void DataStreamerSkipStoreSet(void* ctx, void* obj, - [MarshalAs(UnmanagedType.U1)] bool val); - - [DllImport(IgniteUtils.FileIgniteJniDll, EntryPoint = "IgniteDataStreamerPerNodeBufferSizeGet")] - public static extern int DataStreamerPerNodeBufferSizeGet(void* ctx, void* obj); - - [DllImport(IgniteUtils.FileIgniteJniDll, EntryPoint = "IgniteDataStreamerPerNodeBufferSizeSet")] - public static extern void DataStreamerPerNodeBufferSizeSet(void* ctx, void* obj, int val); - - [DllImport(IgniteUtils.FileIgniteJniDll, EntryPoint = "IgniteDataStreamerPerNodeParallelOperationsGet")] - public static extern int DataStreamerPerNodeParallelOpsGet(void* ctx, void* obj); - - [DllImport(IgniteUtils.FileIgniteJniDll, EntryPoint = "IgniteDataStreamerPerNodeParallelOperationsSet")] - public static extern void DataStreamerPerNodeParallelOpsSet(void* ctx, void* obj, int val); - - [DllImport(IgniteUtils.FileIgniteJniDll, EntryPoint = "IgniteMessagingWithAsync")] - public static extern void* MessagingWithAsync(void* ctx, void* target); - - [DllImport(IgniteUtils.FileIgniteJniDll, EntryPoint = "IgniteProjectionForOthers")] - public static extern void* ProjectionForOthers(void* ctx, void* obj, void* prj); - - [DllImport(IgniteUtils.FileIgniteJniDll, EntryPoint = "IgniteProjectionForRemotes")] - public static extern void* ProjectionForRemotes(void* ctx, void* obj); - - [DllImport(IgniteUtils.FileIgniteJniDll, EntryPoint = "IgniteProjectionForDaemons")] - public static extern void* ProjectionForDaemons(void* ctx, void* obj); - - [DllImport(IgniteUtils.FileIgniteJniDll, EntryPoint = "IgniteProjectionForRandom")] - public static extern void* ProjectionForRandom(void* ctx, void* obj); - - [DllImport(IgniteUtils.FileIgniteJniDll, EntryPoint = "IgniteProjectionForOldest")] - public static extern void* ProjectionForOldest(void* ctx, void* obj); - - [DllImport(IgniteUtils.FileIgniteJniDll, EntryPoint = "IgniteProjectionForYoungest")] - public static extern void* ProjectionForYoungest(void* ctx, void* obj); - - [DllImport(IgniteUtils.FileIgniteJniDll, EntryPoint = "IgniteProjectionResetMetrics")] - public static extern void ProjectionResetMetrics(void* ctx, void* obj); - - [DllImport(IgniteUtils.FileIgniteJniDll, EntryPoint = "IgniteProjectionOutOpRet")] - public static extern void* ProjectionOutOpRet(void* ctx, void* obj, int type, long memPtr); - - [DllImport(IgniteUtils.FileIgniteJniDll, EntryPoint = "IgniteQueryCursorIterator")] - public static extern void QryCursorIterator(void* ctx, void* target); - - [DllImport(IgniteUtils.FileIgniteJniDll, EntryPoint = "IgniteQueryCursorClose")] - public static extern void QryCursorClose(void* ctx, void* target); - [DllImport(IgniteUtils.FileIgniteJniDll, EntryPoint = "IgniteAcquire")] public static extern void* Acquire(void* ctx, void* target); [DllImport(IgniteUtils.FileIgniteJniDll, EntryPoint = "IgniteRelease")] public static extern void Release(void* target); - [DllImport(IgniteUtils.FileIgniteJniDll, EntryPoint = "IgniteTransactionsStart")] - public static extern long TxStart(void* ctx, void* target, int concurrency, int isolation, long timeout, - int txSize); - - [DllImport(IgniteUtils.FileIgniteJniDll, EntryPoint = "IgniteTransactionsCommit")] - public static extern int TxCommit(void* ctx, void* target, long id); - - [DllImport(IgniteUtils.FileIgniteJniDll, EntryPoint = "IgniteTransactionsCommitAsync")] - public static extern void TxCommitAsync(void* ctx, void* target, long id, long futId); - - [DllImport(IgniteUtils.FileIgniteJniDll, EntryPoint = "IgniteTransactionsRollback")] - public static extern int TxRollback(void* ctx, void* target, long id); - - [DllImport(IgniteUtils.FileIgniteJniDll, EntryPoint = "IgniteTransactionsRollbackAsync")] - public static extern void TxRollbackAsync(void* ctx, void* target, long id, long futId); - - [DllImport(IgniteUtils.FileIgniteJniDll, EntryPoint = "IgniteTransactionsClose")] - public static extern int TxClose(void* ctx, void* target, long id); - - [DllImport(IgniteUtils.FileIgniteJniDll, EntryPoint = "IgniteTransactionsState")] - public static extern int TxState(void* ctx, void* target, long id); - - [DllImport(IgniteUtils.FileIgniteJniDll, EntryPoint = "IgniteTransactionsSetRollbackOnly")] - [return: MarshalAs(UnmanagedType.U1)] - public static extern bool TxSetRollbackOnly(void* ctx, void* target, long id); - - [DllImport(IgniteUtils.FileIgniteJniDll, EntryPoint = "IgniteTransactionsResetMetrics")] - public static extern void TxResetMetrics(void* ctx, void* target); - [DllImport(IgniteUtils.FileIgniteJniDll, EntryPoint = "IgniteThrowToJava")] public static extern void ThrowToJava(void* ctx, char* msg); @@ -335,96 +176,8 @@ namespace Apache.Ignite.Core.Impl.Unmanaged [DllImport(IgniteUtils.FileIgniteJniDll, EntryPoint = "IgniteDestroyJvm")] public static extern void DestroyJvm(void* ctx); - [DllImport(IgniteUtils.FileIgniteJniDll, EntryPoint = "IgniteEventsWithAsync")] - public static extern void* EventsWithAsync(void* ctx, void* obj); - - [DllImport(IgniteUtils.FileIgniteJniDll, EntryPoint = "IgniteEventsStopLocalListen")] - [return: MarshalAs(UnmanagedType.U1)] - public static extern bool EventsStopLocalListen(void* ctx, void* obj, long hnd); - - [DllImport(IgniteUtils.FileIgniteJniDll, EntryPoint = "IgniteEventsLocalListen")] - public static extern void EventsLocalListen(void* ctx, void* obj, long hnd, int type); - - [DllImport(IgniteUtils.FileIgniteJniDll, EntryPoint = "IgniteEventsIsEnabled")] - [return: MarshalAs(UnmanagedType.U1)] - public static extern bool EventsIsEnabled(void* ctx, void* obj, int type); - - [DllImport(IgniteUtils.FileIgniteJniDll, EntryPoint = "IgniteServicesWithAsync")] - public static extern void* ServicesWithAsync(void* ctx, void* target); - - [DllImport(IgniteUtils.FileIgniteJniDll, EntryPoint = "IgniteServicesWithServerKeepPortable")] - public static extern void* ServicesWithServerKeepBinary(void* ctx, void* target); - - [DllImport(IgniteUtils.FileIgniteJniDll, EntryPoint = "IgniteServicesCancel")] - public static extern long ServicesCancel(void* ctx, void* target, char* name); - - [DllImport(IgniteUtils.FileIgniteJniDll, EntryPoint = "IgniteServicesCancelAll")] - public static extern long ServicesCancelAll(void* ctx, void* target); - - [DllImport(IgniteUtils.FileIgniteJniDll, EntryPoint = "IgniteServicesGetServiceProxy")] - public static extern void* ServicesGetServiceProxy(void* ctx, void* target, char* name, - [MarshalAs(UnmanagedType.U1)] bool sticky); - - [DllImport(IgniteUtils.FileIgniteJniDll, EntryPoint = "IgniteAtomicLongGet")] - public static extern long AtomicLongGet(void* ctx, void* target); - - [DllImport(IgniteUtils.FileIgniteJniDll, EntryPoint = "IgniteAtomicLongIncrementAndGet")] - public static extern long AtomicLongIncrementAndGet(void* ctx, void* target); - - [DllImport(IgniteUtils.FileIgniteJniDll, EntryPoint = "IgniteAtomicLongAddAndGet")] - public static extern long AtomicLongAddAndGet(void* ctx, void* target, long value); - - [DllImport(IgniteUtils.FileIgniteJniDll, EntryPoint = "IgniteAtomicLongDecrementAndGet")] - public static extern long AtomicLongDecrementAndGet(void* ctx, void* target); - - [DllImport(IgniteUtils.FileIgniteJniDll, EntryPoint = "IgniteAtomicLongGetAndSet")] - public static extern long AtomicLongGetAndSet(void* ctx, void* target, long value); - - [DllImport(IgniteUtils.FileIgniteJniDll, EntryPoint = "IgniteAtomicLongCompareAndSetAndGet")] - public static extern long AtomicLongCompareAndSetAndGet(void* ctx, void* target, long expVal, long newVal); - - [DllImport(IgniteUtils.FileIgniteJniDll, EntryPoint = "IgniteAtomicLongIsClosed")] - [return: MarshalAs(UnmanagedType.U1)] - public static extern bool AtomicLongIsClosed(void* ctx, void* target); - - [DllImport(IgniteUtils.FileIgniteJniDll, EntryPoint = "IgniteAtomicLongClose")] - public static extern void AtomicLongClose(void* ctx, void* target); - - [DllImport(IgniteUtils.FileIgniteJniDll, EntryPoint = "IgniteAtomicSequenceGet")] - public static extern long AtomicSequenceGet(void* ctx, void* target); - - [DllImport(IgniteUtils.FileIgniteJniDll, EntryPoint = "IgniteAtomicSequenceIncrementAndGet")] - public static extern long AtomicSequenceIncrementAndGet(void* ctx, void* target); - - [DllImport(IgniteUtils.FileIgniteJniDll, EntryPoint = "IgniteAtomicSequenceAddAndGet")] - public static extern long AtomicSequenceAddAndGet(void* ctx, void* target, long value); - - [DllImport(IgniteUtils.FileIgniteJniDll, EntryPoint = "IgniteAtomicSequenceGetBatchSize")] - public static extern int AtomicSequenceGetBatchSize(void* ctx, void* target); - - [DllImport(IgniteUtils.FileIgniteJniDll, EntryPoint = "IgniteAtomicSequenceSetBatchSize")] - public static extern void AtomicSequenceSetBatchSize(void* ctx, void* target, int size); - - [DllImport(IgniteUtils.FileIgniteJniDll, EntryPoint = "IgniteAtomicSequenceIsClosed")] - [return: MarshalAs(UnmanagedType.U1)] - public static extern bool AtomicSequenceIsClosed(void* ctx, void* target); - - [DllImport(IgniteUtils.FileIgniteJniDll, EntryPoint = "IgniteAtomicSequenceClose")] - public static extern void AtomicSequenceClose(void* ctx, void* target); - - [DllImport(IgniteUtils.FileIgniteJniDll, EntryPoint = "IgniteAtomicReferenceIsClosed")] - [return: MarshalAs(UnmanagedType.U1)] - public static extern bool AtomicReferenceIsClosed(void* ctx, void* target); - - [DllImport(IgniteUtils.FileIgniteJniDll, EntryPoint = "IgniteAtomicReferenceClose")] - public static extern void AtomicReferenceClose(void* ctx, void* target); - [DllImport(IgniteUtils.FileIgniteJniDll, EntryPoint = "IgniteListenableCancel")] [return: MarshalAs(UnmanagedType.U1)] public static extern bool ListenableCancel(void* ctx, void* target); - - [DllImport(IgniteUtils.FileIgniteJniDll, EntryPoint = "IgniteListenableIsCancelled")] - [return: MarshalAs(UnmanagedType.U1)] - public static extern bool ListenableIsCancelled(void* ctx, void* target); } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ignite/blob/eaf8ae24/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Unmanaged/UnmanagedCallbacks.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Unmanaged/UnmanagedCallbacks.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Unmanaged/UnmanagedCallbacks.cs index 5815b4d..be55ab1 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Unmanaged/UnmanagedCallbacks.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Unmanaged/UnmanagedCallbacks.cs @@ -95,7 +95,7 @@ namespace Apache.Ignite.Core.Impl.Unmanaged private const int OpPrepareDotNet = 1; private delegate long CacheStoreCreateCallbackDelegate(void* target, long memPtr); - private delegate int CacheStoreInvokeCallbackDelegate(void* target, long objPtr, long memPtr, void* cb); + private delegate int CacheStoreInvokeCallbackDelegate(void* target, long objPtr, long memPtr); private delegate void CacheStoreDestroyCallbackDelegate(void* target, long objPtr); private delegate long CacheStoreSessionCreateCallbackDelegate(void* target, long storePtr); @@ -305,20 +305,15 @@ namespace Apache.Ignite.Core.Impl.Unmanaged } [SuppressMessage("Microsoft.Reliability", "CA2000:Dispose objects before losing scope")] - private int CacheStoreInvoke(void* target, long objPtr, long memPtr, void* cb) + private int CacheStoreInvoke(void* target, long objPtr, long memPtr) { return SafeCall(() => { var t = _handleRegistry.Get<CacheStore>(objPtr, true); - IUnmanagedTarget cb0 = null; - - if ((long) cb != 0) - cb0 = new UnmanagedNonReleaseableTarget(_ctx, cb); - using (PlatformMemoryStream stream = IgniteManager.Memory.Get(memPtr).GetStream()) { - return t.Invoke(stream, cb0, _ignite); + return t.Invoke(stream, _ignite); } }); }