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


Java AgentCall类代码示例

本文整理汇总了Java中scouter.server.netio.AgentCall的典型用法代码示例。如果您正苦于以下问题:Java AgentCall类的具体用法?Java AgentCall怎么用?Java AgentCall使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: EmailPlugin

import scouter.server.netio.AgentCall; //导入依赖的package包/类
public EmailPlugin() {
   	if (ai.incrementAndGet() == 1) {
    	ScheduledExecutorService executor = Executors.newScheduledThreadPool(1);
    	
    	// thread count check
    	executor.scheduleAtFixedRate(new Runnable() {
			@Override
			public void run() {
				for (int objHash : javaeeObjHashList) {
					try {
						if (AgentManager.isActive(objHash)) {
							ObjectPack objectPack = AgentManager.getAgent(objHash);
							MapPack mapPack = new MapPack();
			            	mapPack.put("objHash", objHash);
			            	
							mapPack = AgentCall.call(objectPack, RequestCmd.OBJECT_THREAD_LIST, mapPack);
							
			        		int threadCountThreshold = conf.getInt("ext_plugin_thread_count_threshold", 0);
			        		int threadCount = mapPack.getList("name").size();
			        		
			        		if (threadCountThreshold != 0 && threadCount > threadCountThreshold) {
			        			AlertPack ap = new AlertPack();
			        			
			    		        ap.level = AlertLevel.WARN;
			    		        ap.objHash = objHash;
			    		        ap.title = "Thread count exceed a threshold.";
			    		        ap.message = objectPack.objName + "'s Thread count(" + threadCount + ") exceed a threshold.";
			    		        ap.time = System.currentTimeMillis();
			    		        ap.objType = objectPack.objType;
			    				
			    		        alert(ap);
			        		}
						}
					} catch (Exception e) {
						// ignore
					}
				}
			}
    	}, 
    	0, 5, TimeUnit.SECONDS);
   	}
}
 
开发者ID:scouter-project,项目名称:scouter-plugin-server-alert-email,代码行数:43,代码来源:EmailPlugin.java

示例2: SlackPlugin

import scouter.server.netio.AgentCall; //导入依赖的package包/类
public SlackPlugin() {
   	if (ai.incrementAndGet() == 1) {
    	ScheduledExecutorService executor = Executors.newScheduledThreadPool(1);

    	// thread count check
    	executor.scheduleAtFixedRate(new Runnable() {
			@Override
			public void run() {
				for (int objHash : javaeeObjHashList) {
					try {
						if (AgentManager.isActive(objHash)) {
							ObjectPack objectPack = AgentManager.getAgent(objHash);
							MapPack mapPack = new MapPack();
			            	mapPack.put("objHash", objHash);

							mapPack = AgentCall.call(objectPack, RequestCmd.OBJECT_THREAD_LIST, mapPack);

			        		int threadCountThreshold = conf.getInt("ext_plugin_thread_count_threshold", 0);
			        		int threadCount = mapPack.getList("name").size();

			        		if (threadCountThreshold != 0 && threadCount > threadCountThreshold) {
			        			AlertPack ap = new AlertPack();

			    		        ap.level = AlertLevel.WARN;
			    		        ap.objHash = objHash;
			    		        ap.title = "Thread count exceed a threshold.";
			    		        ap.message = objectPack.objName + "'s Thread count(" + threadCount + ") exceed a threshold.";
			    		        ap.time = System.currentTimeMillis();
			    		        ap.objType = objectPack.objType;

			    		        alert(ap);
			        		}
						}
					} catch (Exception e) {
						// ignore
					}
				}
			}
    	},
    	0, 5, TimeUnit.SECONDS);
   	}
}
 
开发者ID:scouter-project,项目名称:scouter-plugin-server-alert-slack,代码行数:43,代码来源:SlackPlugin.java


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