This week's book giveaway is in the Agile and Other Processes forum.
We're giving away four copies of Real-World Software Development: A Project-Driven Guide to Fundamentals in Java and have Dr. Raoul-Gabriel Urma & Richard Warburton on-line!
See this thread for details.
Win a copy of Real-World Software Development: A Project-Driven Guide to Fundamentals in Java this week in the Agile and Other Processes forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Liutauras Vilda
  • Knute Snortum
  • Bear Bibeault
Sheriffs:
  • Devaka Cooray
  • Jeanne Boyarsky
  • Junilu Lacar
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
  • salvin francis
Bartenders:
  • Tim Holloway
  • Piet Souris
  • Frits Walraven

Spring container issue

 
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I am scheduling a task using spring quartz scheduler that send an email to user only once based on the condition.
But due to multi instance creation of spring container it is sending email twice.

Please suggest me how to ensure single instance creation of spring container.

Here is code snapshot of quartz scheduler :
 
Ranch Hand
Posts: 49
1
Tomcat Server Chrome Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Did you already figure out the reason?

This issue happened for me as well, but because job ran second time while first run is not completed.
I have configured a "wait for the first run to complete" version somewhere in the bean definition.

However since you are running your job once a month, it looks more like you initialized scheduler twice.
 
Bartender
Posts: 1682
7
Android Mac OS X IntelliJ IDE Spring Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you clarify this statement?

But due to multi instance creation of spring container it is sending email twice.



You have 2 instances of your application running on different application servers and both executing the same job?
 
mishug Goyal
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Bill,

No, only 1 application is running but somehow it is creating two instances of spring container and doing one single operation twice.

Thanks.
 
Krishna Kanth
Ranch Hand
Posts: 49
1
Tomcat Server Chrome Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think you need to add / enable logging in the initialization block of scheduler to confirm it is getting initialized twice before starting to examine how.
 
The two armies met. But instead of battle, they decided to eat some pie and contemplate this tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!