Java 邮件调度程序

发布于 2025-01-21 03:27:17 字数 252 浏览 1 评论 0原文

鉴于我分别有两个计划的组件类上传文件。 我为每个人创建了一个发送电子邮件方法,以便我自己发送提醒电子邮件,以防发生任何上传异常。

这样的流程:

调度程序一---如果上传过程中的例外 - > 时间后发送电子邮件

在上传期间的例外调度程序两个例外 --->现在在例外发送电子邮件

,现在我想升级为

调度程序一个 +调度程序两个 - 如果例外 - >在两个调度程序之后发送邮件

,我该怎么做?

Given that I have two scheduled component classes uploading files respectively.
I created a sending email method for each of them in order to send a reminder email to myself in case any uploading exceptions happened.

the flow like this:

Scheduler One --- if exception during uploading ---> sending a email after exception

Scheduler Two --- if exception during uploading ---> sending a email after exception

now I want to upgrade as

Scheduler One + Scheduler Two
--if exception--> sending a mail after two scheduler

Nonetheless, how can I do that?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

止于盛夏 2025-01-28 03:27:17

您使用的情况听起来真的很奇怪。调度程序独立运行。因此,如果您想在两个之间共享信息(抛出一个例外),则必须在某个地方存储此信息。在运行时期间,数据库中的条目或保存在全局变量中。

但是,我建议您将两个调度程序合并为一个。如果他们不是独立的,为什么要划分代码?它可以使您免于创建需要连接调度程序的这些hacks

You use case sounds really odd. Schedulers run independent. So if you want to share information (an exception was thrown) between both thos you have to store this information somewhere. A entry in a database or saving in in a global variable during runtime.

I would however suggest that you merge both of you scheduler into one. If they are not independent why divide the code? It saves you from creating theses hacks where the schedulers need to be connected

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文