Ejemplo n.º 1
0
        /** <inheritDoc /> */
        public IClusterMetrics GetMetrics()
        {
            var ignite = (Ignite)_igniteRef.Target;

            if (ignite == null)
            {
                return(_metrics);
            }

            ClusterMetricsImpl oldMetrics = _metrics;

            long lastUpdateTime = oldMetrics.LastUpdateTimeRaw;

            ClusterMetricsImpl newMetrics = ignite.ClusterGroup.RefreshClusterNodeMetrics(_id, lastUpdateTime);

            if (newMetrics != null)
            {
                lock (this)
                {
                    if (_metrics.LastUpdateTime < newMetrics.LastUpdateTime)
                    {
                        _metrics = newMetrics;
                    }
                }

                return(newMetrics);
            }

            return(oldMetrics);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ClusterNodeImpl"/> class.
        /// </summary>
        /// <param name="reader">The reader.</param>
        public ClusterNodeImpl(IPortableRawReader reader)
        {
            _id = reader.ReadGuid() ?? default(Guid);

            _attrs  = reader.ReadGenericDictionary <string, object>().AsReadOnly();
            _addrs  = reader.ReadGenericCollection <string>().AsReadOnly();
            _hosts  = reader.ReadGenericCollection <string>().AsReadOnly();
            _order  = reader.ReadLong();
            _local  = reader.ReadBoolean();
            _daemon = reader.ReadBoolean();

            _metrics = reader.ReadBoolean() ? new ClusterMetricsImpl(reader) : null;
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ClusterNodeImpl"/> class.
        /// </summary>
        /// <param name="reader">The reader.</param>
        public ClusterNodeImpl(IBinaryRawReader reader)
        {
            var id = reader.ReadGuid();

            Debug.Assert(id.HasValue);

            _id = id.Value;

            _attrs    = reader.ReadDictionaryAsGeneric <string, object>().AsReadOnly();
            _addrs    = reader.ReadCollectionAsList <string>().AsReadOnly();
            _hosts    = reader.ReadCollectionAsList <string>().AsReadOnly();
            _order    = reader.ReadLong();
            _isLocal  = reader.ReadBoolean();
            _isDaemon = reader.ReadBoolean();
            _isClient = reader.ReadBoolean();

            _metrics = reader.ReadBoolean() ? new ClusterMetricsImpl(reader) : null;
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ClusterNodeImpl"/> class.
        /// </summary>
        /// <param name="reader">The reader.</param>
        public ClusterNodeImpl(IBinaryRawReader reader)
        {
            var id = reader.ReadGuid();

            Debug.Assert(id.HasValue);

            _id = id.Value;

            _attrs        = ReadAttributes(reader);
            _addrs        = reader.ReadCollectionAsList <string>().AsReadOnly();
            _hosts        = reader.ReadCollectionAsList <string>().AsReadOnly();
            _order        = reader.ReadLong();
            _isLocal      = reader.ReadBoolean();
            _isDaemon     = reader.ReadBoolean();
            _isClient     = reader.ReadBoolean();
            _consistentId = reader.ReadObject <object>();
            _version      = new IgniteProductVersion(reader);

            _metrics = reader.ReadBoolean() ? new ClusterMetricsImpl(reader) : null;
        }