We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
下面代码 copy 自 ScheduleJob,删除了不相干的代码。 这里每次执行 job 的时候,都会单独开个线程,有什么说法吗?
public class ScheduleJob extends QuartzJobBean { private ExecutorService service = Executors.newSingleThreadExecutor(); @Override protected void executeInternal(JobExecutionContext context) throws JobExecutionException { //.... try { ScheduleRunnable task = new ScheduleRunnable(scheduleJob.getBeanName(), scheduleJob.getMethodName(), scheduleJob.getParams()); Future<?> future = service.submit(task); future.get(); // .... } catch (Exception e) { // ... }finally { // ... } } }
我的理解 quartz 框架在处理这些 job 的时候已经是单独的线程了,没有必要在开一个线程。 伪代码如下
public class ScheduleJob extends QuartzJobBean { @Override protected void executeInternal(JobExecutionContext context) throws JobExecutionException { //.... try { Object target = SpringContextUtils.getBean(context.getBeanName()); Method method = context.getBeanName().getClass().getDeclaredMethod(scheduleJob.getMethodName()); method.invoke(target); } catch (Exception e) { // ... }finally { // ... } } }
The text was updated successfully, but these errors were encountered:
确实是多余的,后面会优化这部分代码
Sorry, something went wrong.
No branches or pull requests
下面代码 copy 自 ScheduleJob,删除了不相干的代码。
这里每次执行 job 的时候,都会单独开个线程,有什么说法吗?
我的理解 quartz 框架在处理这些 job 的时候已经是单独的线程了,没有必要在开一个线程。
伪代码如下
The text was updated successfully, but these errors were encountered: