This week's book giveaway is in the Features new in Java 9 forum.
We're giving away four copies of Java 9 Revealed and have Kishori Sharan on-line!
See this thread for details.
Win a copy of Java 9 Revealed this week in the Features new in Java 9 forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

make sure one dispatcher servlet loads after another  RSS feed

 
Darvesh Niz
Ranch Hand
Posts: 123
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello
I have a scenario where we have two dispatcher servlet in our web.xml file.
One of the dispatcher servlet mentioned below have very minimal beans and starts quickly and pass health check and notifies the load balancer thats its ready to serve traffic.



The other dispatcher servlet is heavyweight and has lots of beans and takes almost 1~2 min to initialize.
we want to make sure the first dispatcher only sends a request to load balancer thats its ready to serve traffic once all the spring beans are initialized in the second dispatcher.




some solution which i have on top of my head is
Let the content controller implements InitializingBean and in the afterPropertiesSet() method is fired set a flag as true and expose that as a JMX property.
The healthcheck controller will first check the property exposed as a jmx bean and only send signal to load balancer that its ready to server traffic only if the flag is true.

Is there a way i can defer loading of bean in healthcheck controller by like 2 min or so.

any advice ideas




 
Darvesh Niz
Ranch Hand
Posts: 123
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
any idea

was my question clear
 
H Paul
Ranch Hand
Posts: 491
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Consider a look at the meaning of load-on-startup:

http://stackoverflow.com/questions/809775/what-does-the-servlet-load-on-startup-value-signify
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!