Ejemplo n.º 1
0
 public void SetInstance(MutableMetricsFactory factory)
 {
     lock (this)
     {
         DefaultMetricsFactory.mmfImpl = factory;
     }
 }
Ejemplo n.º 2
0
 public T GetInstance <T>()
 {
     System.Type cls = typeof(T);
     lock (this)
     {
         if (cls == typeof(MutableMetricsFactory))
         {
             if (DefaultMetricsFactory.mmfImpl == null)
             {
                 DefaultMetricsFactory.mmfImpl = new MutableMetricsFactory();
             }
             return((T)DefaultMetricsFactory.mmfImpl);
         }
         throw new MetricsException("Unknown metrics factory type: " + cls.FullName);
     }
 }
Ejemplo n.º 3
0
        internal MetricsSourceBuilder(object source, MutableMetricsFactory factory)
        {
            this.source  = Preconditions.CheckNotNull(source, "source");
            this.factory = Preconditions.CheckNotNull(factory, "mutable metrics factory");
            Type cls = source.GetType();

            registry = InitRegistry(source);
            foreach (FieldInfo field in ReflectionUtils.GetDeclaredFieldsIncludingInherited(cls
                                                                                            ))
            {
                Add(source, field);
            }
            foreach (MethodInfo method in ReflectionUtils.GetDeclaredMethodsIncludingInherited
                         (cls))
            {
                Add(source, method);
            }
        }