コード例 #1
0
        /// <exception cref="System.IO.IOException"/>
        public virtual void ReadFields(DataInput @in)
        {
            numActiveTrackers = @in.ReadInt();
            int numTrackerNames = @in.ReadInt();

            if (numTrackerNames > 0)
            {
                for (int i = 0; i < numTrackerNames; i++)
                {
                    string name = StringInterner.WeakIntern(Org.Apache.Hadoop.IO.Text.ReadString(@in)
                                                            );
                    activeTrackers.AddItem(name);
                }
            }
            numBlacklistedTrackers = @in.ReadInt();
            int blackListTrackerInfoSize = @in.ReadInt();

            if (blackListTrackerInfoSize > 0)
            {
                for (int i = 0; i < blackListTrackerInfoSize; i++)
                {
                    ClusterStatus.BlackListInfo info = new ClusterStatus.BlackListInfo();
                    info.ReadFields(@in);
                    blacklistedTrackersInfo.AddItem(info);
                }
            }
            numExcludedNodes   = @in.ReadInt();
            ttExpiryInterval   = @in.ReadLong();
            map_tasks          = @in.ReadInt();
            reduce_tasks       = @in.ReadInt();
            max_map_tasks      = @in.ReadInt();
            max_reduce_tasks   = @in.ReadInt();
            status             = WritableUtils.ReadEnum <Cluster.JobTrackerStatus>(@in);
            grayListedTrackers = @in.ReadInt();
        }
コード例 #2
0
        /// <summary>test BlackListInfo class</summary>
        /// <exception cref="System.IO.IOException"/>
        public virtual void TestBlackListInfo()
        {
            ClusterStatus.BlackListInfo info = new ClusterStatus.BlackListInfo();
            info.SetBlackListReport("blackListInfo");
            info.SetReasonForBlackListing("reasonForBlackListing");
            info.SetTrackerName("trackerName");
            ByteArrayOutputStream byteOut = new ByteArrayOutputStream();
            DataOutput            @out    = new DataOutputStream(byteOut);

            info.Write(@out);
            ClusterStatus.BlackListInfo info2 = new ClusterStatus.BlackListInfo();
            info2.ReadFields(new DataInputStream(new ByteArrayInputStream(byteOut.ToByteArray
                                                                              ())));
            NUnit.Framework.Assert.AreEqual(info, info);
            NUnit.Framework.Assert.AreEqual(info.ToString(), info.ToString());
            NUnit.Framework.Assert.AreEqual(info.GetTrackerName(), "trackerName");
            NUnit.Framework.Assert.AreEqual(info.GetReasonForBlackListing(), "reasonForBlackListing"
                                            );
            NUnit.Framework.Assert.AreEqual(info.GetBlackListReport(), "blackListInfo");
        }