當前位置: 首頁>>代碼示例>>Java>>正文


Java SimonManager.manager方法代碼示例

本文整理匯總了Java中org.javasimon.SimonManager.manager方法的典型用法代碼示例。如果您正苦於以下問題:Java SimonManager.manager方法的具體用法?Java SimonManager.manager怎麽用?Java SimonManager.manager使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.javasimon.SimonManager的用法示例。


在下文中一共展示了SimonManager.manager方法的12個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: register

import org.javasimon.SimonManager; //導入方法依賴的package包/類
private static SimonManagerMXBeanImpl register() {
	MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
	try {
		ObjectName name = new ObjectName("org.javasimon.jmx.example:type=Simon");
		if (mbs.isRegistered(name)) {
			mbs.unregisterMBean(name);
		}
		SimonManagerMXBeanImpl simon = new SimonManagerMXBeanImpl(SimonManager.manager());
		mbs.registerMBean(simon, name);
		System.out.println("SimonManagerMXBean registerd under name: " + name);
		return simon;
	} catch (JMException e) {
		System.out.println("SimonManagerMXBean registration failed!\n" + e);
	}
	return null;
}
 
開發者ID:virgo47,項目名稱:javasimon,代碼行數:17,代碼來源:MonitoredApplication.java

示例2: register

import org.javasimon.SimonManager; //導入方法依賴的package包/類
/**
 * Register Simon MXBean into platform MBeanServer under
 * {@code org.javasimon.jmx.example:type=Simon} name.
 *
 * @return registered SimonManagerMXBean implementation object
 */
private static SimonManagerMXBean register() {
	MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
	try {
		ObjectName name = new ObjectName("org.javasimon.jmx.example:type=Simon");
		if (mbs.isRegistered(name)) {
			mbs.unregisterMBean(name);
		}
		SimonManagerMXBean simonManagerMXBean = new SimonManagerMXBeanImpl(SimonManager.manager());
		mbs.registerMBean(simonManagerMXBean, name);
		System.out.println("SimonManagerMXBean registerd under name: " + name);
		return simonManagerMXBean;
	} catch (JMException e) {
		System.out.println("SimonManagerMXBean registration failed!\n" + e);
	}
	return null;
}
 
開發者ID:virgo47,項目名稱:javasimon,代碼行數:23,代碼來源:StandaloneExample.java

示例3: initServer

import org.javasimon.SimonManager; //導入方法依賴的package包/類
private void initServer() throws IOException, JMException {
	// Register JMX
	MBeanServer beanServer = ManagementFactory.getPlatformMBeanServer();
	ObjectName beanObjectName = new ObjectName("org.javasimon:type=Manager");
	SimonManagerMXBeanImpl bean = new SimonManagerMXBeanImpl(SimonManager.manager());
	beanServer.registerMBean(bean, beanObjectName);
	// Server
	Map<String, String> serverConfigMap = new HashMap<>();
	JolokiaServerConfig serverConfig = new JolokiaServerConfig(serverConfigMap);
	server = new JolokiaServer(serverConfig, true);
	// Callbacks
	CompositeCallback compositeCallback = new CompositeCallbackImpl();
	// QuantilesCallback automatically configured after 5 splits (5 buckets)
	compositeCallback.addCallback(new AutoQuantilesCallback(5, 5));
	// QuantilesCallback manually configured 5 duration buckets 200ms wide each
	// compositeCallback.addCallback(new FixedQuantilesCallback(0L, 200L, 5));
	// TimelineCallback 10 time range buckets of 1 minute each
	compositeCallback.addCallback(new TimelineCallback(10, 60000L));
	compositeCallback.addCallback(new JmxRegisterCallback(beanServer, "org.javasimon"));
	SimonManager.callback().addCallback(new AsyncCallbackProxyFactory(compositeCallback).newProxy());
	// CallTreeCallback doesn't support asynchronous operation
	SimonManager.callback().addCallback(new CallTreeCallback(50));
}
 
開發者ID:virgo47,項目名稱:javasimon,代碼行數:24,代碼來源:SimonJolokiaDemo.java

示例4: getObject

import org.javasimon.SimonManager; //導入方法依賴的package包/類
/**
 * Get simon manager instance.
 * If singleton is enabled SimonManager.manager() is invoked else new
 * Manager is created.
 * Then callbacks are appended to this manager
 *
 * @return Simon manager
 */
public Manager getObject() throws Exception {
	Manager manager;
	if (singleton) {
		manager = SimonManager.manager();
	} else {
		manager = new SwitchingManager();
	}
	registerCallbacks(manager);
	configureEnabled(manager);
	return manager;
}
 
開發者ID:virgo47,項目名稱:javasimon,代碼行數:20,代碼來源:ManagerFactoryBean.java

示例5: main

import org.javasimon.SimonManager; //導入方法依賴的package包/類
public static void main(String... args) throws Exception {
	Manager manager = SimonManager.manager();

	// Create and start incremental Simons purger
	IncrementalSimonsPurger incrementalSimonsPurger = new IncrementalSimonsPurger(manager);
	incrementalSimonsPurger.start(PURGING_PERIOD, TIME_UNIT);

	Stopwatch stopwatch = manager.getStopwatch("demo.stopwatch");

	// Attempt to create random usage
	Random random = new Random();
	while (true) {

		// If an incremental Simons for a specified key exist in current Stopwatch
		// this statement will print incremental Sample with no Simon name:
		// e.g. StopwatchSample{total=1.37 s, counter=2, max=908 ms, ...}
		// if the key does not exist or was deleted this statement will print "continuous" sample
		// for the Stopwatch including its name:
		// e.g. StopwatchSample{name=demo.stopwatch, total=121 s, counter=97, ... }
		System.out.println(stopwatch.sampleIncrement("key1"));
		Split split = stopwatch.start();
		Thread.sleep(random.nextInt(SLEEP_TIME));
		split.stop();

		System.out.println(stopwatch.sampleIncrement("key2"));
		split = stopwatch.start();
		Thread.sleep(random.nextInt(SLEEP_TIME));
		split.stop();
	}
}
 
開發者ID:virgo47,項目名稱:javasimon,代碼行數:31,代碼來源:IncrementalSimonsPurgerDemo.java

示例6: testStartJmxReporterForDefaultManager

import org.javasimon.SimonManager; //導入方法依賴的package包/類
@Test
public void testStartJmxReporterForDefaultManager() throws Exception {
	JmxReporter.forDefaultManager().beanServer(beanServer).start();

	Manager defaultManager = SimonManager.manager();
	verify(beanServer).registerMBean(argThat(new SimonManagerMXBeanVerifier(defaultManager)), eq(new ObjectName(JmxReporter.DEFAULT_BEAN_NAME)));
}
 
開發者ID:virgo47,項目名稱:javasimon,代碼行數:8,代碼來源:JmxReporterTest.java

示例7: simonMxBeanTest

import org.javasimon.SimonManager; //導入方法依賴的package包/類
@Test
public void simonMxBeanTest() throws Exception {
	ObjectName name = new ObjectName("whatever:type=anything");
	SimonManagerMXBean simonManagerMXBean = new SimonManagerMXBeanImpl(SimonManager.manager());
	mbs.registerMBean(simonManagerMXBean, name);
	mbs.unregisterMBean(name);
}
 
開發者ID:virgo47,項目名稱:javasimon,代碼行數:8,代碼來源:JmxRegistrationCallbackTest.java

示例8: MonitoringInterceptor

import org.javasimon.SimonManager; //導入方法依賴的package包/類
/** Default constructor using {@link SimonManager#manager}. */
public MonitoringInterceptor() {
	super(new SpringStopwatchSource(SimonManager.manager()));
}
 
開發者ID:virgo47,項目名稱:javasimon,代碼行數:5,代碼來源:MonitoringInterceptor.java

示例9: MonitoringHandlerInterceptor

import org.javasimon.SimonManager; //導入方法依賴的package包/類
/**
 * Default constructor: default stopwatch source, default manager.
 */
public MonitoringHandlerInterceptor() {
	stopwatchSource = new HandlerStopwatchSource(SimonManager.manager());
}
 
開發者ID:virgo47,項目名稱:javasimon,代碼行數:7,代碼來源:MonitoringHandlerInterceptor.java

示例10: BasicMonitoringInterceptor

import org.javasimon.SimonManager; //導入方法依賴的package包/類
/** Default constructor using {@link org.javasimon.SimonManager#manager}. */
public BasicMonitoringInterceptor() {
	this(new SpringStopwatchSource(SimonManager.manager()));
}
 
開發者ID:virgo47,項目名稱:javasimon,代碼行數:5,代碼來源:BasicMonitoringInterceptor.java

示例11: beforeMethod

import org.javasimon.SimonManager; //導入方法依賴的package包/類
@BeforeMethod
public void beforeMethod() {
	httpStopwatchSource = new HttpStopwatchSource(SimonManager.manager());
}
 
開發者ID:virgo47,項目名稱:javasimon,代碼行數:5,代碼來源:HttpStopwatchSourceTest.java

示例12: ProxyStopwatchSource

import org.javasimon.SimonManager; //導入方法依賴的package包/類
public ProxyStopwatchSource() {
	super(SimonManager.manager());
}
 
開發者ID:virgo47,項目名稱:javasimon,代碼行數:4,代碼來源:ProxyStopwatchSource.java


注:本文中的org.javasimon.SimonManager.manager方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。