java - Quartz执行定时job后如何将结果返回?
PHPz
PHPz 2017-04-18 09:42:27
0
1
965

用Quartz做定时任务调度

需求是这样的,以整点时间戳为文件名,每隔一小时创建一个文件,在这一小时内不断的写文件,达到下一小时关闭当前文件句柄和流,并以当前整点小时创建新文件

现在可以用JobDataMap将数据传入execute方法,可是在execute中创建文件后,文件句柄和流如何传出,可供读写线程再次操作?

求高人解答!

PHPz
PHPz

学习是最好的投资!

reply all(1)
阿神

Write a singleton service class. The service class has two member variables, one is the file handle and the other is the stream, which can be get and set. Use it as a bean of spring, and inject this bean into both quartz and your reading and writing threads. In quartz, set is used to change handles and streams, and read and write threads use get to read

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!