问题描述
如果我将 Runnable 推送到 redisson 分布式执行器服务,我需要遵守哪些规则?
If I push a Runnable to a redisson distributed executor service, what rules am I required to oblige by?
当然,我不能自由支配,我不明白这是怎么可能的,但是,文档中根本没有提到它,API 也没有明显执行任何规则,像 R 扩展 Serializable 或类似的.
Surely , I can not have free reign, I do not see how that is possible, yet, it is not mention in the docs at all, nor are any rules apparently enforced by the API, like R extends Serializable or similar.
如果我通过了这个 runnable:
If I pass this runnable:
new Runnable(()-> {
// What can I access here, and have it be recreated in whatever server instance picks it up later for execution?
// newlyCreatedInstanceCreatedJustBeforeThisRunnableWasCreated.isAccissible(); // ?
// newlyComplexInstanceSuchAsADatabaseDriverThatisAccessedHere.isAccissible(); // ?
// transactionalHibernateEntityContainingStaticReferencesToComplexObjects....
// I think you get the point.
// Does Redisson serialize everything within this scope?
// When it is recreated later, surely, I can not have access to those exact objects, unless they run on the same server, right?
// If the server goes does and up, or another server executes this runnable, then what happens?
// What rules do we have to abide by here?
})
此外,将某些内容推送到 RQueue、RBlockingDequeu 或 Redisson 活动对象时,我们必须遵守哪些规则?
Also, what rules do we have to abide by when pushing something to a RQueue, RBlockingDequeu, or Redisson live objects?
文档中并不清楚.
此外,如果可以提供指向单个站点文档站点的链接,那就太好了.这里需要大量的点击和导航:
Also, would be great if a link to a single site documentation site could be provided. The one here requires a lot of clickin and navigation:
https://github.com/redisson/redisson/wiki/Table内容
推荐答案
您可以访问 RedisClient 和 taskId.任务对象的完整状态将被序列化.
You can have an access to RedisClient and taskId. Full state of task object will be serialized.
TaskRetry 设置应用于每个任务.如果任务在开始后 5 分钟后仍未执行,则它将重新排队.
TaskRetry setting applied to each task. If task isn't executed after 5 minutes since the moment of start then it will requeued.
这篇关于Redisson 中的分布式执行器服务如何在范围界定/关闭方面工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!