Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Multi-threaded Context initialization with spring?

I have a traditional 3-tier application with spring. One of my repositories needs > 3 minutes for initialization so I thought about some multi-threaded approach in order to speed up the whole process - I think most service and controllers in my dependency tree can already be started so only a few must wait for the last repository to come up.

Is there any best practice approach?

like image 941
Jan Avatar asked Nov 01 '10 14:11

Jan


1 Answers

Use Spring's Executor abstraction. And if you are within a app server then I suggest you use application server's work-manager (spring supports it). For e.g. WebSphere app server and Weblogic both support registering the workmanagers in JNDI. You can then pass the jndi name to spring. Task Executors

like image 108
Aravind Yarram Avatar answered Sep 30 '22 15:09

Aravind Yarram