Exemplo n.º 1
0
        public virtual void startService <S>(string name, PlatformService <S> service)
        {
            lock (this)
            {
                ObjectName serviceName = getObjectName(name);

                if (getService(serviceName) != default(S))
                {
                    throw new ProcessEngineException("Cannot register service " + serviceName + " with MBeans Container, service with same name already registered.");
                }

//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final javax.management.MBeanServer beanServer = getmBeanServer();
                MBeanServer beanServer = getmBeanServer();
                // call the service-provided start behavior
                service.start(this);

                try
                {
                    beanServer.registerMBean(service, serviceName);
                    servicesByName[serviceName] = service;

                    Stack <DeploymentOperation> currentOperationContext = activeDeploymentOperations.get();
                    if (currentOperationContext != null)
                    {
                        currentOperationContext.Peek().serviceAdded(name);
                    }
                }
                catch (Exception e)
                {
                    throw LOG.cannotRegisterService(serviceName, e);
                }
            }
        }
Exemplo n.º 2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @PostConstruct public void postConstruct()
        public virtual void postConstruct()
        {
            string str1 = this.properties.getProperty("code");
            string str2 = this.properties.getProperty("name");

            requireNotNull(str1);
            requireNotNull(str2);
            try
            {
                MBeanServer mBeanServer = ManagementFactory.PlatformMBeanServer;
                ObjectName  objectName  = new ObjectName(str2);
                mBeanServer.registerMBean(this, objectName);
            }
            catch (MalformedObjectNameException malformedObjectNameException)
            {
                this.log.error("Malformed MBean name: " + str2);
                throw new MBeanRegistrationException(malformedObjectNameException);
            }
            catch (InstanceAlreadyExistsException instanceAlreadyExistsException)
            {
                this.log.error("Instance already exists: " + str2);
                throw new MBeanRegistrationException(instanceAlreadyExistsException);
            }
            catch (NotCompliantMBeanException notCompliantMBeanException)
            {
                this.log.error("Class is not a valid MBean: " + str1);
                throw new MBeanRegistrationException(notCompliantMBeanException);
            }
            catch (MBeanRegistrationException mBeanRegistrationException)
            {
                this.log.error("Error registering " + str2 + ", " + str1);
                throw new MBeanRegistrationException(mBeanRegistrationException);
            }
        }
Exemplo n.º 3
0
        public override void Start()
        {
            _support = ManagementSupport.Load();
            _mbs     = _support.MBeanServer;
            _beans   = new LinkedList <Neo4jMBean>();
            try
            {
                Neo4jMBean bean = new KernelBean(_kernelData, _dataSourceManager, _support);
                _mbs.registerMBean(bean, bean.ObjectName);
                _beans.Add(bean);
            }
            catch (Exception)
            {
                _log.info("Failed to register Kernel JMX Bean");
            }

            foreach (ManagementBeanProvider provider in Service.load(typeof(ManagementBeanProvider)))
            {
                try
                {
                    foreach (Neo4jMBean bean in provider.LoadBeans(_kernelData, _support))
                    {
                        _mbs.registerMBean(bean, bean.ObjectName);
                        _beans.Add(bean);
                    }
                }
                catch (Exception e)
                {
                    _log.info("Failed to register JMX Bean " + provider + " (" + e + ")");
                }
            }
            try
            {
                Neo4jMBean bean = new ConfigurationBean(_kernelData, _support);
                _mbs.registerMBean(bean, bean.ObjectName);
                _beans.Add(bean);
            }
            catch (Exception)
            {
                _log.info("Failed to register Configuration JMX Bean");
            }
        }
Exemplo n.º 4
0
 public override void Start()
 {
     try
     {
         ServerManagement serverManagement = new ServerManagement(_server);
         MBeanServer      beanServer       = ManagementFactory.PlatformMBeanServer;
         beanServer.registerMBean(serverManagement, CreateObjectName());
     }
     catch (Exception e)
     {
         throw new Exception("Unable to initialize jmx management, see nested exception.", e);
     }
 }
Exemplo n.º 5
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public Void run() throws javax.management.InstanceAlreadyExistsException, javax.management.MBeanRegistrationException, javax.management.NotCompliantMBeanException
            public virtual Void Run()
            {
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final javax.management.DynamicMBean dmbean;
                DynamicMBean dmbean;

                if (Pmo is DynamicMBean)
                {
                    dmbean = typeof(DynamicMBean).cast(Pmo);
                }
                else if (Pmo is NotificationEmitter)
                {
                    dmbean = new StandardEmitterMBean(Pmo, null, true, (NotificationEmitter)Pmo);
                }
                else
                {
                    dmbean = new StandardMBean(Pmo, null, true);
                }

                Mbs.registerMBean(dmbean, Pmo.ObjectName);
                return(null);
            }
Exemplo n.º 6
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public Void run() throws javax.management.InstanceAlreadyExistsException, javax.management.MBeanRegistrationException, javax.management.NotCompliantMBeanException
            public virtual Void Run()
            {
                Mbs.registerMBean(Dmbean, On);
                return(null);
            }