Playframework并发作业管理 [英] Playframework concurrent jobs management

查看:268
本文介绍了Playframework并发作业管理的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想对多个并发作业管理有一些建议:事实上,我在我的应用程序中使用两个不同的工作:

I would like to have some advise on multiple concurrent job management in play : in fact, i'm using in my application two distincts jobs :


  • 第一个工作是一个快速的:它尝试使用WS.url()方法到达两个不同的URL,并将结果状态记录到数据库中。
    如果网站没有响应,则重试三次。

  • the first job is a quick one : it tries to reach two distinct url using WS.url() method and record the resulting status into database. Three retry are done if a website does not responding. This task takes less than 20s to finish, and is going to be run every 5 minutes.

第二个工作是缓慢的:它解析内容到两个网站如果他们的状态记录到数据库是确定。这个过程大约需要2分钟,而且每小时都会完成。

the second job is a slow one : it parses content into both websites if their status recorded into database is ok. This process takes around 2 minutes, and is going to be done every hour.

一个作业正在运行,另一个作业不能被抬起,并且将要等待电流的结束开始。
我非常新的锁使用和并发访问,所以每一个建议是宝贵的我!

I wanted to be sure that if one job is running, another one can't be raised, and is going to wait the end of current to start. I'm very new with locks usage and concurrent access, so every advise is precious to me !

推荐答案

如果你想简单,可以在第一个工作开始。

If you want to make it simple you could start the second job in the first one..

检查服务后最后一行是

new URLParserJob().now();

这篇关于Playframework并发作业管理的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆