如何忽略Weblogic Server中的卡住线程 [英] How do I ignore stuck threads in a Weblogic Server
问题描述
我在Weblogic Application Server 10.3.2上使用了以下代码.在timerExpired上执行的长时间运行的任务所花费的时间比服务器范围内的StuckThreadMaxTime的时间长600秒.我不想修改此值,而只是忽略此处理线程的卡住线程超时.
I've got the below code working on Weblogic Application Server 10.3.2. The long running task executed on timerExpired takes longer than the server wide StuckThreadMaxTime of 600 seconds. I do not want to modify this value, but just to ignore the stuck thread timeout for this particular thread of processing.
我可以从中看到如何使用commonj WorkManager来完成此任务: http://download.oracle.com/docs/cd /E11035_01/wls100/config_wls/self_tuned.html#wp1069945
I can see how this can be accomplished using a commonj WorkManager from this: http://download.oracle.com/docs/cd/E11035_01/wls100/config_wls/self_tuned.html#wp1069945
然后将以下内容添加到weblogic.xml文件中的work-manager标记中:
And then by adding the following to the work-manager tag in the weblogic.xml file:
<ignore-stuck-threads>true</ignore-stuck-threads>
但是我到底该如何对Timer/TimerManager进行同样的操作?
But how on earth do I do the same for a Timer/TimerManager?
web.xml
<resource-ref>
<res-ref-name>tm/TestTimer</res-ref-name>
<res-type>commonj.timers.TimerManager</res-type>
<res-auth>Container</res-auth>
<res-sharing-scope>Unshareable</res-sharing-scope>
</resource-ref>
TestTimer.java:
TestTimer.java:
import commonj.timers.Timer;
import commonj.timers.TimerListener;
import commonj.timers.TimerManager;
public class TestTimer implements TimerListener {
public void init()
TimerManager timerManager =
(TimerManager)initContext.lookup("java:comp/env/tm/TestTimer");
timerManager.schedule(this, SCHEDULE_DELAY);
}
@Override
public void timerExpired(Timer timer) {
// perform long-running task
}
}
推荐答案
我通过在计时器到期时执行由WorkManager安排的工作中的处理来轻松解决问题(时间压力).
I took the easy way out (time pressures) by doing the processing in work scheduled by a WorkManager when the timer expires.
public MyClass implements TimerListener, Work
@Override
public void timerExpired(Timer timer) throws Exception {
WorkManager workManager = initContext.lookup("wm/myworkmanager");
workManager.schedule(this);
}
@Override
public void run() {
doWork();
}
}
web.xml
<resource-ref>
<res-ref-name>wm/myworkmanager</res-ref-name>
<res-type>commonj.work.WorkManager</res-type>
<res-auth>Container</res-auth>
<res-sharing-scope>Unshareable</res-sharing-scope>
</resource-ref>
weblogic.xml
weblogic.xml
<wls:work-manager>
<wls:name>wm/myworkmanager</wls:name>
<wls:ignore-stuck-threads>true</wls:ignore-stuck-threads>
</wls:work-manager>
这篇关于如何忽略Weblogic Server中的卡住线程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!