adb*_*dkb 4 java-ee-6 ejb-3.1 websphere-8
当我们将持久化EJBTimer与@schedule和persistent = true一起使用时,将其部署到集群,然后我们在@Schedule中更改实际计划并重新部署到集群,原始计划是否被新计划替换(删除并添加了新参数),或者两个时间表都保持活动状态(请记住设置了persistent = true)
这是我到目前为止所读到的内容 - Each scheduler instance has a unique jndi name and @schedule automatically creates a timer through application deployment so it would be better to remove the automatic created EJBTimer or cancel the original schedule to avoid trouble. 但我不知道如何以编程方式取消原始计划,或者如果原始和更改的计划都保持活动状态,则需要由websphere管理员完成
同样从本文档中,removeAutomaticEJBTimers命令用于从指定的调度程序中删除计时器,但这似乎也出现在websphere管理员的区域,而不是开发人员.
开发人员如何以编程方式取消使用@Schedule注释创建的自动EJBTimer?
我正在使用Java EE 6和Websphere 8.5和EJB 3.1.
小智 6
执行以下操作以删除持久性EJB计时器:
删除目录jboss-home\standalone\data\timer-service-data {yourporjectname}.{serivename}
请参阅本页使用 EJB 计时器服务创建计时器
当您在服务器运行时卸载应用程序时,应用程序服务器会自动从数据库中删除持久自动计时器。如果应用程序服务器未运行,您必须手动从数据库中删除自动计时器。此外,如果您在服务器未运行时添加、删除或更改自动计时器的元数据,则必须手动删除自动计时器。
我有以下课程:
@Stateless
@LocalBean
public class HelloBean {
@Schedule(persistent=true, minute="*", hour="*", info="myTimer")
public void printHello() {
System.out.println("### hello");
}
}
Run Code Online (Sandbox Code Playgroud)
当我将其安装到服务器上时,我可以找到相关的自动计时器:
C:\IBM\WebSphere\AppServer85\profiles\AppSrv02\bin>findEJBTimers.bat server1 -all
ADMU0116I: Tool information is being logged in file C:\IBM\WebSphere\AppServer85\profiles\AppSrv02\logs\server1\EJBTimers.log
ADMU0128I: Starting tool with the AppSrv02 profile
ADMU3100I: Reading configuration for server: server1
EJB timer : 3 Expiration: 2/14/15 12:39 PM Calendar
EJB : ScheduleTestEAR, ScheduleTest.jar, HelloBean
Info : myTimer
Automatic timer with timout method: printHello
Calendar expression: [start=null, end=null, timezone=null, seconds="0",
minutes="*", hours="*", dayOfMonth="*", month="*", dayOfWeek="*", year="*"]
1 EJB timer tasks found
Run Code Online (Sandbox Code Playgroud)
卸载应用程序后,计时器将被删除:
C:\IBM\WebSphere\AppServer85\profiles\AppSrv02\bin>findEJBTimers.bat server1 -all
ADMU0116I: Tool information is being logged in file
C:\IBM\WebSphere\AppServer85\profiles\AppSrv02\logs\server1\EJBTimers.log
ADMU0128I: Starting tool with the AppSrv02 profile
ADMU3100I: Reading configuration for server: server1
0 EJB timer tasks found
Run Code Online (Sandbox Code Playgroud)
我不知道您如何“重新部署”应用程序,但看起来您的流程不正确。与正常安装/卸载/更新过程一样,自动计时器被正确删除。
更新
在同一页面上您有有关 ND 环境的信息:
当卸载其包含的模块或应用程序时,自动持久计时器将从其持久存储中删除。因此,请勿使用转出更新功能来更新使用自动持久计时器的应用程序。这样做会在集群仍在运行时卸载并重新安装应用程序,这可能会在以下情况下导致失败:
如果在删除数据库条目之后和重新创建数据库条目之前激活在另一个集群成员中运行的计时器,则该计时器将失败。在这种情况下,com.ibm.websphere.scheduler.TaskPending 异常将与 SCHD0057W 消息一起写入首次故障数据捕获 (FFDC),指示数据库中的任务信息已更改或取消。
如果在数据库中的计时器数据更新后,计时器在尚未更新的集群成员上激活,则如果新的计时器信息与仍在运行的旧应用程序代码不兼容,则计时器可能会失败或导致其他故障。集群成员。
| 归档时间: |
|
| 查看次数: |
4729 次 |
| 最近记录: |