本文整理汇总了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);
}
}