Java Code Examples for org.springframework.jmx.export.MBeanExporter#setBeans()
The following examples show how to use
org.springframework.jmx.export.MBeanExporter#setBeans() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MBeanClientInterceptorTests.java From spring-analysis-note with MIT License | 5 votes |
@Override public void onSetUp() throws Exception { target = new JmxTestBean(); target.setAge(100); target.setName("Rob Harrop"); MBeanExporter adapter = new MBeanExporter(); Map<String, Object> beans = new HashMap<>(); beans.put(OBJECT_NAME, target); adapter.setServer(getServer()); adapter.setBeans(beans); adapter.setAssembler(new ProxyTestAssembler()); start(adapter); }
Example 2
Source File: AbstractMetadataAssemblerTests.java From spring-analysis-note with MIT License | 5 votes |
@Test public void testWithCglibProxy() throws Exception { IJmxTestBean tb = createJmxTestBean(); ProxyFactory pf = new ProxyFactory(); pf.setTarget(tb); pf.addAdvice(new NopInterceptor()); Object proxy = pf.getProxy(); MetadataMBeanInfoAssembler assembler = (MetadataMBeanInfoAssembler) getAssembler(); MBeanExporter exporter = new MBeanExporter(); exporter.setBeanFactory(getContext()); exporter.setAssembler(assembler); String objectName = "spring:bean=test,proxy=true"; Map<String, Object> beans = new HashMap<>(); beans.put(objectName, proxy); exporter.setBeans(beans); start(exporter); MBeanInfo inf = getServer().getMBeanInfo(ObjectNameManager.getInstance(objectName)); assertEquals("Incorrect number of operations", getExpectedOperationCount(), inf.getOperations().length); assertEquals("Incorrect number of attributes", getExpectedAttributeCount(), inf.getAttributes().length); assertTrue("Not included in autodetection", assembler.includeBean(proxy.getClass(), "some bean name")); }
Example 3
Source File: MBeanClientInterceptorTests.java From java-technology-stack with MIT License | 5 votes |
@Override public void onSetUp() throws Exception { target = new JmxTestBean(); target.setAge(100); target.setName("Rob Harrop"); MBeanExporter adapter = new MBeanExporter(); Map<String, Object> beans = new HashMap<>(); beans.put(OBJECT_NAME, target); adapter.setServer(getServer()); adapter.setBeans(beans); adapter.setAssembler(new ProxyTestAssembler()); start(adapter); }
Example 4
Source File: AbstractMetadataAssemblerTests.java From java-technology-stack with MIT License | 5 votes |
@Test public void testWithCglibProxy() throws Exception { IJmxTestBean tb = createJmxTestBean(); ProxyFactory pf = new ProxyFactory(); pf.setTarget(tb); pf.addAdvice(new NopInterceptor()); Object proxy = pf.getProxy(); MetadataMBeanInfoAssembler assembler = (MetadataMBeanInfoAssembler) getAssembler(); MBeanExporter exporter = new MBeanExporter(); exporter.setBeanFactory(getContext()); exporter.setAssembler(assembler); String objectName = "spring:bean=test,proxy=true"; Map<String, Object> beans = new HashMap<>(); beans.put(objectName, proxy); exporter.setBeans(beans); start(exporter); MBeanInfo inf = getServer().getMBeanInfo(ObjectNameManager.getInstance(objectName)); assertEquals("Incorrect number of operations", getExpectedOperationCount(), inf.getOperations().length); assertEquals("Incorrect number of attributes", getExpectedAttributeCount(), inf.getAttributes().length); assertTrue("Not included in autodetection", assembler.includeBean(proxy.getClass(), "some bean name")); }
Example 5
Source File: ServerJmxConfig.java From Spring with Apache License 2.0 | 5 votes |
@Bean public MBeanExporter mbeanExporter(final MBeanExample mBeanExample) { final Map<String, Object> beans = new HashMap<>(); beans.put("beans:name=MBeanExample", mBeanExample); final MBeanExporter exporter = new MBeanExporter(); exporter.setBeans(beans); return exporter; }
Example 6
Source File: SpringMBeanExporterBootstrap.java From thinking-in-spring-boot-samples with Apache License 2.0 | 5 votes |
@Bean public MBeanExporter mBeanExporter(Calculator calculator) { MBeanExporter exporter = new MBeanExporter(); Map<String, Object> beans = new HashMap<>(); beans.put("production.ready.jmx.spring:name=Calculator", calculator); exporter.setBeans(beans); return exporter; }
Example 7
Source File: ProcessStepsConfiguration.java From multiapps-controller with Apache License 2.0 | 5 votes |
@Inject @Bean public MBeanExporter jmxExporter(Metrics metrics, DataSource dataSource) { MBeanExporter mBeanExporter = new MBeanExporter(); Map<String, Object> beans = new HashMap<>(); beans.put(METRICS_BEAN, metrics); if (dataSource instanceof DelegatingDataSource) { dataSource = ((DelegatingDataSource) dataSource).getTargetDataSource(); } beans.put(DATASOURCE_BEAN, dataSource); mBeanExporter.setBeans(beans); return mBeanExporter; }
Example 8
Source File: MBeanClientInterceptorTests.java From spring4-understanding with Apache License 2.0 | 5 votes |
@Override public void onSetUp() throws Exception { target = new JmxTestBean(); target.setAge(100); target.setName("Rob Harrop"); MBeanExporter adapter = new MBeanExporter(); Map<String, Object> beans = new HashMap<String, Object>(); beans.put(OBJECT_NAME, target); adapter.setServer(getServer()); adapter.setBeans(beans); adapter.setAssembler(new ProxyTestAssembler()); start(adapter); }
Example 9
Source File: AbstractMetadataAssemblerTests.java From spring4-understanding with Apache License 2.0 | 5 votes |
@Test public void testWithCglibProxy() throws Exception { IJmxTestBean tb = createJmxTestBean(); ProxyFactory pf = new ProxyFactory(); pf.setTarget(tb); pf.addAdvice(new NopInterceptor()); Object proxy = pf.getProxy(); MetadataMBeanInfoAssembler assembler = (MetadataMBeanInfoAssembler) getAssembler(); MBeanExporter exporter = new MBeanExporter(); exporter.setBeanFactory(getContext()); exporter.setAssembler(assembler); String objectName = "spring:bean=test,proxy=true"; Map<String, Object> beans = new HashMap<String, Object>(); beans.put(objectName, proxy); exporter.setBeans(beans); start(exporter); MBeanInfo inf = getServer().getMBeanInfo(ObjectNameManager.getInstance(objectName)); assertEquals("Incorrect number of operations", getExpectedOperationCount(), inf.getOperations().length); assertEquals("Incorrect number of attributes", getExpectedAttributeCount(), inf.getAttributes().length); assertTrue("Not included in autodetection", assembler.includeBean(proxy.getClass(), "some bean name")); }