當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。