Example #1
0
        protected internal virtual IList <object> AllBeans()
        {
            IList <object> beans = new List <object>();
            IEnumerable <ObjectInstance> mbeans;

            try
            {
                mbeans = Server.queryMBeans(MbeanQuery(), null);
            }
            catch (IOException)
            {
                return(beans);
            }
            foreach (ObjectInstance instance in mbeans)
            {
                string className = instance.ClassName;
                Type   beanType  = null;
                try
                {
                    if (!string.ReferenceEquals(className, null))
                    {
                        beanType = Type.GetType(className);
                    }
                }
                catch (Exception ignored) when(ignored is Exception || ignored is LinkageError)
                {
                    // fall through
                }
                if (beanType != null)
                {
                    try
                    {
                        beans.Add(BeanProxy.Load(Server, beanType, instance.ObjectName));
                    }
                    catch (Exception)
                    {
                        // fall through
                    }
                }
            }
            return(beans);
        }
Example #2
0
 protected internal virtual T GetBean <T>(Type beanInterface)
 {
     beanInterface = typeof(T);
     return(BeanProxy.Load(Server, beanInterface, CreateObjectName(beanInterface)));
 }
Example #3
0
 protected internal virtual ICollection <T> GetBeans <T>(Type beanInterface)
 {
     beanInterface = typeof(T);
     return(BeanProxy.LoadAll(Server, beanInterface, CreateObjectNameQuery(beanInterface)));
 }
Example #4
0
 protected internal override T MakeProxy <T>(KernelBean kernel, ObjectName name, Type beanInterface)
 {
     beanInterface = typeof(T);
     return(BeanProxy.Load(MBeanServer, beanInterface, name));
 }