本文整理匯總了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);
}
}
示例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);
}
}