Пример #1
0
        /// <summary>
        /// QueryContinuous implementation.
        /// </summary>
        private IContinuousQueryHandle <ICacheEntry <TK, TV> > QueryContinuousImpl(ContinuousQuery <TK, TV> qry,
                                                                                   QueryBase initialQry)
        {
            qry.Validate();

            var hnd = new ContinuousQueryHandleImpl <TK, TV>(qry, Marshaller, _flagKeepPortable);

            using (var stream = IgniteManager.Memory.Allocate().Stream())
            {
                var writer = Marshaller.StartMarshal(stream);

                hnd.Start(_ignite, writer, () =>
                {
                    if (initialQry != null)
                    {
                        writer.WriteInt((int)initialQry.OpId);

                        initialQry.Write(writer, KeepPortable);
                    }
                    else
                    {
                        writer.WriteInt(-1); // no initial query
                    }
                    FinishMarshal(writer);

                    // ReSharper disable once AccessToDisposedClosure
                    return(UU.CacheOutOpContinuousQuery(Target, (int)CacheOp.QryContinuous, stream.SynchronizeOutput()));
                }, qry);
            }

            return(hnd);
        }