PerformanceMonitorBeanFactory extends PerformanceMonitorFactory implements InitializingBean { public synchronized PerformanceMonitor createPerformanceMonitor( String name) { PerformanceMonitorBean performanceMonitor = findPerformanceMonitorBean(name); if (performanceMonitor == null) { performanceMonitor = new PerformanceMonitorBean(); if (mBeanExportOperations != null) { ObjectName objectName; try { objectName = new ObjectName( "org.fishwife.jrugged.spring:type=" + "PerformanceMonitorBean,name=" + name); } catch (MalformedObjectNameException e) { throw new IllegalArgumentException( "Invalid MBean Name " + name, e); } mBeanExportOperations.registerManagedResource( performanceMonitor, objectName); } addPerformanceMonitorToMap(name, performanceMonitor); } return performanceMonitor; } PerformanceMonitorBeanFactory(); void afterPropertiesSet(); void setInitialPerformanceMonitors(List<String> initialPerformanceMonitors); void setPackageScanBase(String packageScanBase); void createInitialPerformanceMonitors(); @Deprecated void setMBeanExporter(MBeanExporter mBeanExporter); void setMBeanExportOperations(MBeanExportOperations mBeanExportOperations); synchronized PerformanceMonitor createPerformanceMonitor(
            String name); PerformanceMonitorBean findPerformanceMonitorBean(String name);  }
@Test public void testCreatePerformanceMonitor() { PerformanceMonitor createdMonitor = factory.createPerformanceMonitor("testCreate"); assertNotNull(createdMonitor); }
@Test public void testCreateDuplicatePerformanceMonitor() { String name = "testCreate"; PerformanceMonitor createdMonitor = factory.createPerformanceMonitor(name); PerformanceMonitor secondMonitor = factory.createPerformanceMonitor(name); assertSame(createdMonitor, secondMonitor); }