Ejemplo n.º 1
0
 public CarbonWriter(CarbonWriterConfiguration config)
 {
     listener        = StatsListener.Default;
     collectionTimer = new Timer(Periodic, null, Timeout.Infinite, 60000);
     collectionTimer.Change(10000, 60000);
     senderThread = new Thread(Sender)
     {
         Name = "carbon-sender", IsBackground = true
     };
     OnConfigChange(config);
 }
Ejemplo n.º 2
0
        private void OnConfigChange(CarbonWriterConfiguration configuration)
        {
            lock (locker)
            {
                config = configuration;
                if (client != null)
                {
                    client.Close();
                    client = null;
                }

                if (config != null && config.Enabled && !senderThread.IsAlive)
                {
                    collectionTimer.Change(0, config.BufferMillis);
                    senderThread.Start();
                }
            }
        }