Skip to content
New issue

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

Quartz Components WITH Cluster Support [SPR-3797] #8477

Closed
spring-issuemaster opened this Issue Aug 23, 2007 · 8 comments

Comments

Projects
None yet
2 participants
@spring-issuemaster
Copy link
Collaborator

commented Aug 23, 2007

Stephen M. Wick opened SPR-3797 and commented

Through Spring v2.0.2, MethodInvokingJobDetailFactoryBean cannot be used within a clustered Quartz deployment.

I am attaching a cluster-safe version of Spring's MethodInvokingJobDetailFactoryBean, and a new BeanInvokingJobDetailFactoryBean for your review and possible inclusion in the Spring framework offering.

MethodInvokingJobDetailFactoryBean can be used to invoke a method on a Java Object. The Object and method arguments must be Serializable. Alternatively, you can configure this FactoryBean to invoke a Static method on any Class by specifying the name of the Class, as a String, and the name of the Static Method to invoke. Again, the method arguments must be Serializable. (See the JavaDoc within the source for more information)

BeanInvokingJobDetailFactoryBean can be used to invoke a method on any bean defined within the Spring ApplicationContext. The method arguments must be Serializable. (See the JavaDoc within the source for more information)

Note : As of Quartz 1.6.0 there is a bug that prevents Objects from being Serialized to the MS SQL Server (required for Quartz Clustering). (See http://forums.opensymphony.com/messa...ssageID=128249)
Therefore, the following limitations apply to those using MS SQL Server until Quartz 1.6.1 is released:
MethodInvokingJobDetailFactoryBean is restricted to Static No-Arg Method Invocation.
BeanInvokingJobDetailFactoryBean is restricted to No-Arg Method Invocation.

Please let me know if you have issues with these FactoryBeans. I am also looking for feedback on how useful, or not, these components are.

I hope these components save you time and effort!


Affects: 1.0 RC1, 1.0 RC2, 1.0 final, 1.0.1, 1.0.2, 1.1 RC1, 1.1 RC2, 1.1 final, 1.1.1, 1.1.2, 1.1.3, 1.1.4, 1.1.5, 1.2 RC1, 1.2 RC2, 1.2 final, 1.2.1, 1.2.2, 1.2.3, 1.2.4, 1.2.5, 1.2.6, 1.2.7, 1.2.8, 2.0 M1, 2.0 M2, 2.0 M3, 2.0 M4, 2.0 M5, 2.0 RC1, 2.0 RC2, 2.0 RC3, 2.0 RC4, 2.0 final, 2.0.1, 2.0.2, 1.2.9

Attachments:

3 votes, 4 watchers

@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

commented Aug 23, 2007

Stephen M. Wick commented

This code has been posted to the Spring Forum at http://forum.springframework.org/showthread.php?p=138133#post138133 for public review and discussion.

@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

commented Aug 23, 2007

Stephen M. Wick commented

This code is also posted on the OpenSymphony Quartz forum for discussion and review: http://forums.opensymphony.com/thread.jspa?threadID=114463&tstart=0

@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

commented Sep 23, 2008

Markus Kramer commented

Great code! Exactly what I was looking for.

I am using BeanInvokingJobDetailFactoryBean with spring 2.5.4 and quartz 1.6.0 and it fixed the "Unable to serialize JobDataMap for insertion into database because the value of property 'methodInvoker' is not serializable" bug.

Hope this code will make it into spring soon.

@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

commented Sep 25, 2008

Markus Kramer commented

I think there is a bug in BeanInvokingJobDetailFactoryBean.java
If the bean referenced by targetBean is a JdkDynamicAopProxy, the MethodInvoker will throw an exception. This seems to be the case if the bean implements ApplicationContextAware.

org.quartz.JobExecutionException: java.lang.NoSuchMethodException: $Proxy32.dosomething(java.lang.String) [See nested exception: java.lang.NoSuchMethodException: $Proxy32.dosomething(java.lang.String)]
at frameworkx.springframework.scheduling.quartz.BeanInvokingJobDetailFactoryBean$BeanInvokingJob.execute(BeanInvokingJobDetailFactoryBean.java:517)
at org.quartz.core.JobRunShell.run(JobRunShell.java:202)
at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:529)

I fixed it in changing:
Object bean = applicationContext.getBean(targetBean);
logger.debug("applicationContext resolved bean name/id '"+targetBean+"' to "+bean);

to
Object bean = applicationContext.getBean(targetBean);
if (bean instanceof Advised) {
Advised advised = (Advised) bean;
bean = advised.getTargetSource().getTarget();
}
logger.debug("applicationContext resolved bean name/id '"+targetBean+"' to "+bean);

@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

commented Sep 25, 2008

Stephen M. Wick commented

Good catch Markus, and nice solution. I never tried that scenario.

@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

commented Jun 18, 2012

Rossen Stoyanchev commented

This issue has been resolved through a selective bulk update, as part of a larger effort to better manage unresolved issues. To qualify for the update, the issue was either created before Spring 3.0 or affects a version older than Spring 3.0 and is not a bug.

There is a good chance the request was made obsolete, or at least partly outdated, by changes in later versions of Spring including deprecations. It is also possible it didn't get enough traction or we didn't have enough time to address it. One way or another, we didn't get to it.

If you believe the issue, or some aspects of it, are still relevant and worth pursuing at present you may re-open this issue or create a new one with a more up-to-date description.

We thank you for your contributions and encourage you to become familiar with the current process of managing Spring Framework JIRA issues that has been in use for over a year.

@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

commented Aug 1, 2012

Knut commented

There seems to be still no way to use
org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean
in a clustered Quartz scheduler setup.

The solution (incl. the posted fix for JdkDynamicAopProxy) works fine for me but will need some adaptions to work with Quartz 2 (I may be able to supply this during the next days).

A deeper integration with MethodInvokingJobDetailFactoryBean would be nice to avoid duplication of code and adaption works.

@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

commented Sep 22, 2015

Juergen Hoeller commented

Closing groups of outdated issues. Please reopen if still relevant.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.