Comments (9)
首先,Stop不是一个保证可靠的方法,如果发现任务仍在 running,可以再次 Stop。
其次,Stop 任务的前提条件是该任务能被 stop,也就是需要有能被打断的点,比如 Thread.sleep,如果线程一直占用 CPU 执行,Java并没有提供 API 来终止该线程。
最后,如果还有问题的,欢迎继续反馈。顺便带上你的操作系统信息、Java版本、PowerJob版本等信息。
from powerjob.
类似与SchedulerX2 的
public void kill(JobContext context)
https://help.aliyun.com/document_detail/148193.html
因为停止是否成功和业务有关。
from powerjob.
也就是增加一个回调接口,让你自己处理 kill 逻辑吧。
说实话框架设计阶段我考虑过这个方案,但是先不到具体的业务应用场景,能麻烦你举个例子吗?
如果有合适的业务场景,我会在下个版本支持的。
from powerjob.
也就是增加一个回调接口,让你自己处理 kill 逻辑吧。
说实话框架设计阶段我考虑过这个方案,但是先不到具体的业务应用场景,能麻烦你举个例子吗?
如果有合适的业务场景,我会在下个版本支持的。
1L 那个就是很常见的场景。
from powerjob.
不好意思,我其实没太看懂 1L 那个例子的意思 😂
代码在同步执行的时候,我提供给你调用 kill 接口的方法也无济于事啊......
其实我想问的是:
什么情况下需要主动结束任务,我认为的 stopInstance 是用在机器过载情况下手动停止某些任务实例的方法,所以只是一个单纯打断的操作。在我这种理解下,stopInstance 的实现也就是简单的打断线程。
而根据你的描述,似乎是把 stopInstance 作为了一个比较常规的业务操作,我很想知道是什么样的场景下需要使用 stopInstance。
from powerjob.
阿里云的kill示例 嘻嘻
from powerjob.
所以说,这个示例只是为了演示而演示的。
如果 kill 的意义是让任务停止,我直接 stop 线程不是一样能到达效果吗?
我需要的是真实有意义的且目前我这种 stop 机制无法支持的业务场景。
如果没有,那其实就是没有必要的需求。
from powerjob.
这个例子的 stop 判断完全可以换成 Thread.interrupted(),我的 stop 一样能达到目的。
from powerjob.
@KFCFans 我遇到个实际情况,就是监听socket端口接收数据,点运行后确实监听了,但是无法终止,并且jvm配置了-Dpowerjob.worker.allowed-force-stop-thread=true
from powerjob.
Related Issues (20)
- 请问调度中心server如何集群部署 HOT 1
- 有一个任务报错 no worker available,其他任务正常运行 HOT 3
- 服务端运行一段时间后,会出现cpu使用率超高问题,必须得重启服务端进程才能降下来 HOT 4
- 控制台一直打印心跳,可以关了吗,没找到配置 HOT 1
- CoreScheduleTaskManager Questions HOT 4
- Supports Tomcat HOT 2
- 前端bug:工作流实例,instance/detailPlus详情接口的instanceId在右侧详情没有收拢的情况下不会变 HOT 1
- 工作流中多个节点的参数不同,最终执行时却使用了同一个参数
- 源码部署应用程序异常退出
- launching powerjobServer in docker container time is not consist with Host Node HOT 1
- MapProcessor 添加子任务报错
- 运行中的任务手动停止后,刷新列表又变成《运行中》状态
- 请问work端是否提供了进去process前的拦截器,类似servlet filter机制? HOT 4
- 同一任务 一定case下 被不同server 调度到 不同 worker 节点 HOT 1
- PowerJobClient如何关闭
- OpenAPI 方式下,TimeExpressionType入参与后端接口获取的不匹配的bug HOT 6
- server分批部署存在第一个启动的server节点管理大量app的问题
- 期望expectTriggerTime放入 task
- no further information: /127.0.0.1:10010
- no further information: /127.0.0.1:10010
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from powerjob.