Exemple #1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @PreDestroy public void preDestroy()
        public virtual void preDestroy()
        {
            string str = this.properties.getProperty("name");

            try
            {
                MBeanServer mBeanServer = ManagementFactory.PlatformMBeanServer;
                ObjectName  objectName  = new ObjectName(str);
                mBeanServer.unregisterMBean(objectName);
            }
            catch (MalformedObjectNameException malformedObjectNameException)
            {
                this.log.error("Malformed MBean name: " + str);
                throw new MBeanRegistrationException(malformedObjectNameException);
            }
            catch (MBeanRegistrationException mBeanRegistrationException)
            {
                this.log.error("Error unregistering " + str);
                throw new MBeanRegistrationException(mBeanRegistrationException);
            }
            catch (InstanceNotFoundException instanceNotFoundException)
            {
                this.log.error("Error unregistering " + str);
                throw new MBeanRegistrationException(instanceNotFoundException);
            }
        }
Exemple #2
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: protected void tearDown() throws Exception
        protected internal virtual void tearDown()
        {
            // make sure all MBeans are removed after each test
            MBeanServer mBeanServer = serviceContainer.getmBeanServer();

            if (mBeanServer.isRegistered(service1ObjectName))
            {
                mBeanServer.unregisterMBean(service1ObjectName);
            }
            if (mBeanServer.isRegistered(service2ObjectName))
            {
                mBeanServer.unregisterMBean(service2ObjectName);
            }
            if (mBeanServer.isRegistered(service3ObjectName))
            {
                mBeanServer.unregisterMBean(service3ObjectName);
            }
            if (mBeanServer.isRegistered(service4ObjectName))
            {
                mBeanServer.unregisterMBean(service4ObjectName);
            }
            base.tearDown();
        }
 public override void Stop()
 {
     foreach (Neo4jMBean bean in _beans)
     {
         try
         {
             _mbs.unregisterMBean(bean.ObjectName);
         }
         catch (Exception e)
         {
             _log.warn("Could not unregister MBean " + bean.ObjectName.ToString(), e);
         }
     }
 }
Exemple #4
0
 public override void Stop()
 {
     try
     {
         MBeanServer beanServer = ManagementFactory.PlatformMBeanServer;
         beanServer.unregisterMBean(CreateObjectName());
     }
     catch (InstanceNotFoundException)
     {
         // ok
     }
     catch (Exception e)
     {
         throw new Exception("Unable to shut down jmx management, see nested exception.", e);
     }
 }
Exemple #5
0
        public virtual void stopService(string name)
        {
            lock (this)
            {
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final javax.management.MBeanServer mBeanServer = getmBeanServer();
                MBeanServer mBeanServer = getmBeanServer();

                ObjectName serviceName = getObjectName(name);

//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.camunda.bpm.container.impl.spi.PlatformService<Object> service = getService(serviceName);
                PlatformService <object> service = getService(serviceName);

                ensureNotNull("Cannot stop service " + serviceName + ": no such service registered", "service", service);

                try
                {
                    // call the service-provided stop behavior
                    service.stop(this);
                }
                finally
                {
                    // always unregister, even if the stop method throws an exception.
                    try
                    {
                        mBeanServer.unregisterMBean(serviceName);
                        servicesByName.Remove(serviceName);
                    }
                    catch (Exception t)
                    {
                        throw LOG.exceptionWhileUnregisteringService(serviceName.CanonicalName, t);
                    }
                }
            }
        }