Ejemplo n.º 1
0
        private void FillMetrics(StringBuilder stats, ClientConnection ownerConnection)
        {
            AddStat(stats, "lastStatisticsCollectionTime", Clock.CurrentTimeMillis());
            AddStat(stats, "enterprise", "false");
            AddStat(stats, "clientType", "CSHARP");
            AddStat(stats, "clientVersion", DllVersion);
            AddStat(stats, "clusterConnectionTimestamp", ownerConnection.ConnectionStartTime);
            AddStat(stats, "clientAddress", ownerConnection.GetLocalSocketAddress());
            AddStat(stats, "clientName", _client.GetName());

            var credentials = _client.GetConnectionManager().LastCredentials;

            AddStat(stats, "credentials.principal", credentials.GetPrincipal());

            foreach (var pair in _gauges)
            {
                var gaugeName      = pair.Key;
                var gaugeValueFunc = pair.Value;
                try
                {
                    var value = gaugeValueFunc();
                    AddStat(stats, gaugeName, value);
                }
                catch (Exception e)
                {
                    if (Logger.IsFinestEnabled())
                    {
                        Logger.Finest(string.Format("Could not collect data for gauge {0}", gaugeName), e);
                    }
                }
            }
        }
        public void FireLifecycleEvent(LifecycleEvent.LifecycleState lifecycleState)
        {
            var lifecycleEvent = new LifecycleEvent(lifecycleState);

            Logger.Info("HazelcastClient[" + _client.GetName() + "] is " + lifecycleEvent.GetState());
            foreach (var entry in _lifecycleListeners)
            {
                entry.Value.StateChanged(lifecycleEvent);
            }
        }