天道酬勤,学无止境

commonj

即使在 Websphere 中停止应用程序后,线程也会继续运行(Thread keeps running even after application has been stopped in Websphere)

问题 我有一个长时间运行的线程,它是使用带有 Spring 的org.springframework.scheduling.commonj.WorkManagerTaskExecutor创建的,并且在 Websphere Application Server 8 中运行。 问题是即使应用程序已停止,该线程仍会继续运行。 该线程也需要停止,但没有发生。 我什至尝试使用Thread.currentThread().isInterrupted()来检查当前线程是否被中断,但它总是返回false 。 因此,无法通过我的代码知道线程是否应该继续运行或停止。 这是我对 WorkManagerTaskExecutor 的 spring 配置: <bean id="taskExecutor" class="org.springframework.scheduling.commonj.WorkManagerTaskExecutor"> <property name="workManagerName" value="wm/default" /> </bean> 线程是这样执行的: Thread t = new EmailReaderThread(email); workManagerTaskExecutor.execute(t); 我错过了什么? 我该怎么做才能使应用程序停止时应用程序的线程

2022-02-09 07:29:58    分类:技术分享    java   spring   websphere   threadpool   commonj

Thread keeps running even after application has been stopped in Websphere

I have a long running thread which is created using org.springframework.scheduling.commonj.WorkManagerTaskExecutor with Spring and is running in Websphere Application Server 8. The problem is that this thread keeps running even if the application has been stopped. That thread needs to be stopped too but it is not happening. I even tried to use Thread.currentThread().isInterrupted() to check if the current thread was interrupted but it always returns false. So there is no way to know through my code if the Thread should keep running or stop. This is my spring configuration for the

2022-01-08 15:45:20    分类:问答    java   spring   websphere   threadpool   commonj

在 GlassFish 和 Spring 3 中使用 CommonJ 实现(Using a CommonJ implementation with GlassFish and Spring 3)

问题 为了统一 Websphere 7 和 GlassFish 3 环境之间的部署,我决定尝试在 GlassFish 中实现 CommonJ WorkManager 和 TimerManager。 但它并不像预期的那样工作。 我做了以下工作: 使用在以下位置找到的 myFOO CommonJ 实现:http://commonj.myfoo.de/ 并将库包含到我的 domain/lib 文件夹中(包括 Spring 库) 将以下内容添加到 glassfish domain.xml 的<resources>部分: <custom-resource res-type="commonj.work.WorkManager" jndi-name="wm/default" factory-class="de.myfoo.commonj.work.FooWorkManagerFactory"></custom-resource> <custom-resource res-type="commonj.timers.TimerManager" jndi-name="tm/default" factory-class="de.myfoo.commonj.timers.FooTimerManagerFactory"></custom-resource> 在 domain.xml 的<servers> /

2021-12-24 06:36:42    分类:技术分享    spring   jakarta-ee   glassfish   commonj   workmanagers

Using a CommonJ implementation with GlassFish and Spring 3

In my quest to unify deployment among Websphere 7 and GlassFish 3 environments, I decided to try implementing a CommonJ WorkManager and TimerManager in GlassFish. But it isn't quite working as expected. I have done the following: Use the myFOO CommonJ implementation found at: http://commonj.myfoo.de/ and include the libraries into my domain/lib folder (including the Spring libs) Added the following to the <resources> section of the glassfish domain.xml: <custom-resource res-type="commonj.work.WorkManager" jndi-name="wm/default" factory-class="de.myfoo.commonj.work.FooWorkManagerFactory"><

2021-11-29 00:30:27    分类:问答    spring   jakarta-ee   glassfish   commonj   workmanagers

需要示例代码解释 Tomcat 中的 Workmanager(Need sample code explaning Workmanager in Tomcat)

问题 我想知道如何在 Tomcat 7 中使用 WorkManager。我遇到了开源库Foo-CommonJ,但没有找到解释用法的示例代码。 FooWorkManager 构造函数的输入参数是commonj.work.work 类的一个实例,因为没有人提供commonj.work.work类(tomcat 和foo-commonj 都没有)。 基本上我需要一个示例代码来解释在 tomcat 中 WorkManager (FooCommonj jar) 的用法。 如果 Foo-Commonj 不能正确支持 workmanager,那么还有其他选择。 回答1 JSR-237 已被撤回,但已与 JSR-236 合并。 http://jcp.org/en/jsr/detail?id=237 原因:JSR 237 已与 JSR 236 合并,为 Java EE 并发提供单一、一致的规范。 回答2 老派的方式 复制到 jars 后的 tomcat\lib 文件夹: commonj-xxx.jar tomcat-commonj-xxx.jar 在您的应用程序或 tomcat 的 context.xml 中创建一个新的 WorkManager 实例: <Resource name="wm/myWorkManager" type="commonj.work.WorkManager" auth=

2021-09-29 07:42:58    分类:技术分享    multithreading   tomcat   asynchronous   workmanagers   commonj

Need sample code explaning Workmanager in Tomcat

I want to know how to use WorkManager in Tomcat 7. I came across the open source library Foo-CommonJ but nowhere i found a sample code explaning the usage. The input parameter for FooWorkManager's constructor is an instance of commonj.work.work class, where as no one provides the commonj.work.work class (neither tomcat nor foo-commonj). Basically i need a sample code explaining usage of WorkManager (FooCommonj jar) in tomcat. And if Foo-Commonj doesn't support workmanager properly, then some alternative.

2021-09-29 06:10:39    分类:问答    multithreading   tomcat   asynchronous   workmanagers   commonj

How do I ignore stuck threads in a Weblogic Server

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. 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 And then by adding the following to the work-manager tag in the weblogic.xml file: <ignore-stuck-threads>true</ignore-stuck

2021-07-01 23:15:53    分类:问答    multithreading   weblogic   commonj

Weblogic Server 11g 上的自定义线程(Custom Thread on Weblogic Server 11g)

问题 我的 weblogic 服务器上需要一个自定义线程; 我不能使用 TimerEJB 或 Delayed MDB,因为我必须使用 3d 库。 我知道不鼓励应用服务器上的自定义线程; 这里有一篇相关的帖子(4 岁):为什么不鼓励在 Java EE 容器中生成线程? 是不是还气馁? 我可以使用ExecutorService或 Quartz 吗? 或者我只需要考虑 commonj 和工人经理? 回答1 在 Weblogic 11g (EJB3.0) 上,不鼓励创建“自己的线程执行器”(另请参阅 Java EE 规范和多线程),您应该使用: 定时器服务 例子: MyEjb { @Stateless public class TimerBean implements TimerRemote { @Resource TimerService service; @Override public void startTimer() { Timer timer = service.createTimer(1000, 1000, null); System.out.println("Timers set"); } @Timeout public void handleTimeout(Timer timer) { System.out.println("Handle timeout event

2021-06-11 12:02:42    分类:技术分享    java   multithreading   weblogic11g   commonj

Custom Thread on Weblogic Server 11g

I need a custom threda on my weblogic server; I cannot use TimerEJB or Delayed MDB since I have to use a 3d library. I know that custom threads on application server are discouraged; here a related post (4 years old): Why is spawning threads in Java EE container discouraged? Is it still discouraged? Can I use ExecutorService or Quartz? Or I have to consider only commonj and worker manager?

2021-05-17 11:16:42    分类:问答    java   multithreading   weblogic11g   commonj