Exemplo n.º 1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ServiceDescriptor" /> class.
        /// </summary>
        /// <param name="name">Name.</param>
        /// <param name="reader">Reader.</param>
        /// <param name="services">Services.</param>
        public ServiceDescriptor(string name, PortableReaderImpl reader, IServices services)
        {
            Debug.Assert(reader != null);
            Debug.Assert(services != null);
            Debug.Assert(!string.IsNullOrEmpty(name));

            _services = services;
            Name      = name;

            CacheName       = reader.ReadString();
            MaxPerNodeCount = reader.ReadInt();
            TotalCount      = reader.ReadInt();
            OriginNodeId    = reader.ReadGuid() ?? Guid.Empty;
            AffinityKey     = reader.ReadObject <object>();

            var mapSize = reader.ReadInt();
            var snap    = new Dictionary <Guid, int>(mapSize);

            for (var i = 0; i < mapSize; i++)
            {
                snap[reader.ReadGuid() ?? Guid.Empty] = reader.ReadInt();
            }

            TopologySnapshot = snap.AsReadOnly();
        }
Exemplo n.º 2
0
        public int JobResultRemote(ComputeJobHolder job, PlatformMemoryStream stream)
        {
            // 1. Unmarshal result.
            PortableReaderImpl reader = _compute.Marshaller.StartUnmarshal(stream);

            Guid nodeId    = reader.ReadGuid().Value;
            bool cancelled = reader.ReadBoolean();

            try
            {
                object err;

                var data = PortableUtils.ReadWrappedInvocationResult(reader, out err);

                // 2. Process the result.
                return((int)JobResult0(new ComputeJobResultImpl(data, (Exception)err, job.Job, nodeId, cancelled)));
            }
            catch (Exception e)
            {
                Finish(default(TR), e);

                if (!(e is IgniteException))
                {
                    throw new IgniteException("Failed to process job result: " + e.Message, e);
                }

                throw;
            }
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="ServiceDescriptor" /> class.
        /// </summary>
        /// <param name="name">Name.</param>
        /// <param name="reader">Reader.</param>
        /// <param name="services">Services.</param>
        public ServiceDescriptor(string name, PortableReaderImpl reader, IServices services)
        {
            Debug.Assert(reader != null);
            Debug.Assert(services != null);
            Debug.Assert(!string.IsNullOrEmpty(name));

            _services = services;
            Name = name;

            CacheName = reader.ReadString();
            MaxPerNodeCount = reader.ReadInt();
            TotalCount = reader.ReadInt();
            OriginNodeId = reader.ReadGuid() ?? Guid.Empty;
            AffinityKey = reader.ReadObject<object>();

            var mapSize = reader.ReadInt();
            var snap = new Dictionary<Guid, int>(mapSize);

            for (var i = 0; i < mapSize; i++)
                snap[reader.ReadGuid() ?? Guid.Empty] = reader.ReadInt();

            TopologySnapshot = snap.AsReadOnly();
        }
Exemplo n.º 4
0
 /// <summary>
 /// Reads a node from stream.
 /// </summary>
 private IClusterNode ReadNode(PortableReaderImpl r)
 {
     return(GetNode(r.ReadGuid()));
 }