private void awaitActive(String type, String name, String version) {
     try {
         ObjectName objectName = new ObjectName("org.eclipse.virgo.kernel:type=Model,artifact-type=" + type + ",name=" + name + ",version=" + version);
         ManageableArtifact artifact = JMX.newMXBeanProxy(this.mBeanServer, objectName, ManageableArtifact.class);
         
         long startTime = System.currentTimeMillis();
         
         while (!"ACTIVE".equals(artifact.getState())) {
             if (System.currentTimeMillis() - startTime > TIMEOUT) {
                 fail("Artifact " + type + " " + name + " " + version + " was not active within " + TIMEOUT + "ms.");
             }
             try {
                 Thread.sleep(50);
             } catch (InterruptedException _) {
             }
         }
     } catch (JMException jme) {
         fail(jme.getMessage());
     }
 }
 private void registerRecordProcessor(final RecordProcessor processor, final Endpoint ep) {
   MBeanServer mbeanServer = mBeanServerValue.getValue();
   if (mbeanServer != null) {
     try {
       mbeanServer.registerMBean(
           processor,
           ObjectNameFactory.create(ep.getName() + ",recordProcessor=" + processor.getName()));
     } catch (final JMException ex) {
       ROOT_LOGGER.trace(
           "Cannot register endpoint with JMX server, trying with the default ManagedRecordProcessor: "
               + ex.getMessage());
       try {
         mbeanServer.registerMBean(
             new ManagedRecordProcessor(processor),
             ObjectNameFactory.create(ep.getName() + ",recordProcessor=" + processor.getName()));
       } catch (final JMException e) {
         ROOT_LOGGER.cannotRegisterRecordProcessor();
       }
     }
   } else {
     ROOT_LOGGER.mBeanServerNotAvailable(processor);
   }
 }