/// <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, PortableWriterImpl 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);

            ContinuousQueryFilterHolder filterHolder = _filter == null || qry.Local ? null :
                                                       new ContinuousQueryFilterHolder(typeof(TK), typeof(TV), _filter, _keepPortable);

            writer.WriteObject(filterHolder);

            writer.WriteInt(qry.BufferSize);
            writer.WriteLong((long)qry.TimeInterval.TotalMilliseconds);
            writer.WriteBoolean(qry.AutoUnsubscribe);

            // 4. Call Java.
            _nativeQry = cb();

            // 5. Initial query.
            var nativeInitialQryCur = UU.ContinuousQueryGetInitialQueryCursor(_nativeQry);

            _initialQueryCursor = nativeInitialQryCur == null
                ? null
                : new QueryCursor <TK, TV>(nativeInitialQryCur, _marsh, _keepPortable);
        }
Exemple #2
0
        /// <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;

            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);

            // 4. Call Java.
            _nativeQry = cb();

            // 5. Initial query.
            var nativeInitialQryCur = UU.ContinuousQueryGetInitialQueryCursor(_nativeQry);

            _initialQueryCursor = nativeInitialQryCur == null
                ? null
                : new QueryCursor <TK, TV>(nativeInitialQryCur, _marsh, _keepBinary);
        }