modules/platforms/dotnet/Apache.Ignite.Core/Impl/PlatformJniTarget.cs
/// <summary>
/// Creates a future and starts listening.
/// </summary>
/// <typeparam name="T">Future result type</typeparam>
/// <param name="listenAction">The listen action.</param>
/// <param name="keepBinary">Keep binary flag, only applicable to object futures. False by default.</param>
/// <param name="convertFunc">The function to read future result from stream.</param>
/// <returns>Created future.</returns>
Creates a future and starts listening.
Creates a future and starts listening .
[SuppressMessage("Microsoft.Reliability", "CA2000:Dispose objects before losing scope")]
        private Future<T> GetFuture<T>(Func<long, int, GlobalRef> listenAction, bool keepBinary = false,
            Func<BinaryReader, T> convertFunc = null)
        {
            var futType = FutureType.Object;
            var type = typeof(T);
            if (type.IsPrimitive)
                IgniteFutureTypeMap.TryGetValue(type, out futType);
            var fut = convertFunc == null && futType != FutureType.Object
                ? new Future<T>()
                : new Future<T>(new FutureConverter<T>(_marsh, keepBinary, convertFunc));
            var futHnd = _marsh.Ignite.HandleRegistry.Allocate(fut);
            GlobalRef futTarget;
            try
            {
                futTarget = listenAction(futHnd, (int)futType);
            }
            catch (Exception)
            {
                _marsh.Ignite.HandleRegistry.Release(futHnd);
                throw;
            }
            fut.SetTarget(new Listenable(new PlatformJniTarget(futTarget, _marsh)));
            return fut;
        }
[ SuppressMessage ( " " , " " ) ] private Future < T > GetFuture < T > ( Func < long , int , GlobalRef > listenAction , bool keepBinary = false , Func < BinaryReader , T > convertFunc = null ) { var futType = FutureType . Object ; var type = typeof ( T ) ; if ( type . IsPrimitive ) IgniteFutureTypeMap . TryGetValue ( type , out futType ) ; var fut = convertFunc == null && futType != FutureType . Object ? new Future < T > ( ) : new Future < T > ( new FutureConverter < T > ( _marsh , keepBinary , convertFunc ) ) ; var futHnd = _marsh . Ignite . HandleRegistry . Allocate ( fut ) ; GlobalRef futTarget ; try { futTarget = listenAction ( futHnd , ( int ) futType ) ; } catch ( Exception ) { _marsh . Ignite . HandleRegistry . Release ( futHnd ) ; throw ; } fut . SetTarget ( new Listenable ( new PlatformJniTarget ( futTarget , _marsh ) ) ) ; return fut ; }
Creates a future and starts listening.
Creates a future and starts listening .
None
listenAction
Func<long, int, GlobalRef>
The listen action.
The listen action .
keepBinary
bool
Keep binary flag, only applicable to object futures. False by default.
Keep binary flag only applicable to object futures . False by default .
convertFunc
Func<BinaryReader, T>
The function to read future result from stream.
The function to read future result from stream .
typeparam
Future result type
Future result type