Beispiel #1
0
        public ThreadSafeQueue(int limit, string qName, APPLICATION_DATA appData)
        {
            queueName = qName;

            healthStats = (APPLICATION_DATA.HEALTH_STATISTICS)appData.HealthStatistics;

            tsQ       = new Queue <T>();
            singleton = new object();
            Limit     = limit;
        }
Beispiel #2
0
            public void SendHealthStats(APPLICATION_DATA.HEALTH_STATISTICS stats)
            {
                try
                {
                    string info   = protocol.BuildStatsString(stats);
                    byte[] packet = protocol.CreatePacket(RCS_Protocol.RCS_Protocol.PACKET_TYPES.SEND_STATS, info);

                    writer.Write(packet, 0, packet.Length);

                    mPacketCount++;
                }
                catch (Exception ex)
                {
                    writer.Close();
                    reader.Close();
                    socketStream.Close();
                    connection.Close();
                    ConnectionClosed(this);
                    m_Log.Trace(ex, ErrorLog.LOG_TYPE.INFORMATIONAL);
                }
            }
Beispiel #3
0
        ///////////////////////////////////////////////////
        ///
        ///
        //   STATS STRING PARSING

        public string BuildStatsString(APPLICATION_DATA.HEALTH_STATISTICS stats)
        {
            string info = null;

            string[] statNames = stats.GetStatList();
            string   s;

            foreach (string name in statNames)
            {
                s = stats[name].PerSecond.GetNameValue();
                if (s != null)
                {
                    info += s;
                    info += ",";
                }

                s = stats[name].RunningAverage.GetNameValue();
                if (s != null)
                {
                    info += s;
                    info += ",";
                }

                s = stats[name].Accumulator.GetNameValue();
                if (s != null)
                {
                    info += s;
                    info += ",";
                }

                s = stats[name].Snapshot.GetNameValue();
                if (s != null)
                {
                    info += s;
                    info += ",";
                }

                s = stats[name].Peak.GetNameValue();
                if (s != null)
                {
                    info += s;
                    info += ",";
                }


                s = stats[name].StatString.GetNameValue();
                if (s != null)
                {
                    info += s;
                    info += ",";
                }


                s = stats[name].boolean.GetNameValue();
                if (s != null)
                {
                    info += s;
                    info += ",";
                }



                s = stats[name].SnapshotDouble.GetNameValue();
                if (s != null)
                {
                    info += s;
                    info += ",";
                }
            }


            return(info);
        }