简体   繁体   English

批处理vs EJB计时器

[英]Batchlet vs EJB Timer

I did an application to do some testing on network nodes like ping test, retrieve disk space ans so on. 我做了一个应用程序,在网络节点上进行了一些测试,例如ping测试,检索磁盘空间等。

I use a scheduled batchlet to run the actions but I wonder if it is the rigth use of batchlet? 我使用计划的批处理来运行操作,但是我想知道这是否是批处理的正确使用?

Does an EJB timer should be more relevant? EJB计时器应该更相关吗? Also, when I run a batchlet, my glassfish server keeps a log of the batch job and I don't necessary need it (especially with the amount of batch jobs genereted during a day). 另外,当我运行一个批处理时,我的glassfish服务器会保留该批处理作业的日志,而我并不需要它(尤其是一天中生成的批处理作业的数量)。

If I need to run some job in the same schedule time, I think batchled can do it but EJB timer too? 如果我需要在相同的计划时间内运行某些作业,我认为批处理可以做到,但是EJB计时器也可以吗?

Could you give me your input on the rigth way to achieve this? 您能给我您提出实现这一目标的正确方法的意见吗?

Thanks, Ersch 谢谢,Ersch

Using an EJB timer is appropriate when your task executes in an eye blink (or thereabouts). 当您的任务在眨眼间(或附近)执行时,使用EJB计时器是合适的。

Otherwise use the batching mechanism. 否则,使用批处理机制。

Long running tasks executed from EJB timers can be problematical because they execute in transactions which normally time out after a short period of time. 从EJB计时器执行的长时间运行的任务可能会出现问题,因为它们在通常会在短时间后超时的事务中执行。 Increasing this transaction time out also increases the chances of database and perhaps other resource locks which can impact normal operation of your application. 增加此事务超时也会增加数据库以及其他可能影响应用程序正常运行的资源锁定的机会。

This isn't a question with a clear answer, but there is a bit of a cost in factoring your application as a batch job, and I would look at what I'm getting to see if it's worth doing so. 这不是一个有明确答案的问题,但是将您的应用程序作为批处理工作需要花费一些成本,我将看一下我将要看看是否值得这样做。

So you're thinking about a job consisting of a single Batchlet step. 因此,您正在考虑由一个Batchlet步骤组成的工作。 Well, there'd be nothing gained from "restart" functions, neither at the failing step within a job nor leveraging checkpoints within a chunk step. 好的,“重新启动”功能没有任何好处,无论是在工作失败的步骤中,还是在大块步骤中利用检查点。 The batchlet programming model is quite simple... even if you really like @BatchProperty you'd have to deal with an XML now to do so. 批处理编程模型非常简单...即使您确实喜欢@BatchProperty,也必须立即处理XML。

This only starts to get more interesting if you want to start, view, and manage these executions along with the rest of your batch jobs. 仅当您要启动,查看和管理这些执行以及其余批处理作业时,这才变得更加有趣。 This might be because you're working with an implementation that offers some kind of implementation-specific add-on function. 这可能是因为您正在使用提供某种特定于实现的附加功能的实现。 An example of this could be an integration with external scheduler software, allowing jobs to be scheduled by it. 这方面的一个示例可能是与外部调度程序软件的集成,从而允许由其调度作业。 At the other extreme, if you found value in having a persisted record of all your batch job executions in one place (the job repository, usually a persistent DB), then that could also make this worthwhile for you. 在另一个极端,如果您发现在一个位置上保存所有批处理作业执行的持久性记录(作业存储库,通常是持久性数据库)的价值,那么这对于您也很有价值。

But if you don't care for any of that, then an EJB timer could be the way to go instead. 但是,如果您不关心其中任何一个,那么可以使用EJB计时器代替。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM