当前位置: 首页>>代码示例>>Java>>正文


Java MBeanExporter.setBeans方法代码示例

本文整理汇总了Java中org.springframework.jmx.export.MBeanExporter.setBeans方法的典型用法代码示例。如果您正苦于以下问题:Java MBeanExporter.setBeans方法的具体用法?Java MBeanExporter.setBeans怎么用?Java MBeanExporter.setBeans使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.springframework.jmx.export.MBeanExporter的用法示例。


在下文中一共展示了MBeanExporter.setBeans方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onSetUp

import org.springframework.jmx.export.MBeanExporter; //导入方法依赖的package包/类
@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);
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:15,代码来源:MBeanClientInterceptorTests.java

示例2: testWithCglibProxy

import org.springframework.jmx.export.MBeanExporter; //导入方法依赖的package包/类
@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"));
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:28,代码来源:AbstractMetadataAssemblerTests.java

示例3: jmxService

import org.springframework.jmx.export.MBeanExporter; //导入方法依赖的package包/类
@Bean
@DependsOn("statisticsService")
public MBeanExporter jmxService(Statistics statistics) {
    MBeanExporter exporter = new MBeanExporter();
    exporter.setBeans(ImmutableMap.of("Hibernate:application=Statistics", (Object) statistics));
    return exporter;
}
 
开发者ID:przodownikR1,项目名称:springJpaKata,代码行数:8,代码来源:JmxConfig.java

示例4: onSetUp

import org.springframework.jmx.export.MBeanExporter; //导入方法依赖的package包/类
@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());
	adapter.afterPropertiesSet();
}
 
开发者ID:deathspeeder,项目名称:class-guard,代码行数:15,代码来源:MBeanClientInterceptorTests.java

示例5: testWithCglibProxy

import org.springframework.jmx.export.MBeanExporter; //导入方法依赖的package包/类
@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);
	exporter.afterPropertiesSet();

	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"));
}
 
开发者ID:deathspeeder,项目名称:class-guard,代码行数:28,代码来源:AbstractMetadataAssemblerTests.java

示例6: mBeanExporter

import org.springframework.jmx.export.MBeanExporter; //导入方法依赖的package包/类
@Bean
public MBeanExporter mBeanExporter(JobOperator jobOperator) {
	Map<String, Object> map = new HashMap<>();
	map.put("kr.spring.batch:name=jobOperator", jobOperator);

	MBeanExporter exporter = new MBeanExporter();
	exporter.setBeans(map);

	return exporter;
}
 
开发者ID:debop,项目名称:spring-batch-experiments,代码行数:11,代码来源:StopConfiguration.java


注:本文中的org.springframework.jmx.export.MBeanExporter.setBeans方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。