I have a quartz scheduler with spring application.
Each time quartz triggers a job, the job creates a list (say list of dogs). The next time quartz triggers another job, I need access to access the list created by the previous job. How can I achieve this.
I cannot use a single instance of the object. As this object can be used by other processes which create its own lists (say list of cows, list of birds etc)
The effect i am looking for is similar to an instance variable and executing something in a loop, and each time in the loop you update the instance variable, the new value of the instance variable is accessible to the next iteration of the loop.
Thanks in advance
You need some global storage accessible by all jobs. In Spring you can inject beans into jobs and keep that list in one of the beans. You can also take advantage of
JobDataMap. However it might serialize your collection and deserialize it back.The problem is actually more complex. Remember that Quartz can be run on multiple nodes. In that case you are left with
JobDataMapstored as BLOB in the database or using database yourself (say, one row per dog).