Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Add preStop and postStop methods to perform custom task when exiting app #181
We were needed these methods to effectate some additionnal operations, like shutdown properly the database.
Here is the situation we have :
Adding a postStop allow us "to be sure" that all additionnal wave, like RE_SAVE, have finish to process before shuting down the database.
I say "to be sure" in quote because when I looked to the code I can see that when we close the JRebirth Thread we end the current task queue process. In case of "force close", we completely clear the queue.
It depends of the timeout value used: closeRetryDelayFirst closeRetryDelayOther
By default we wait 4s before exit, than 1s if waves are still processed.
But after these 4+1s , all pending tasks are cleared
The idea was to avoid to be blocked by waiting something that will never stop.
So your proposal is good but I have a doubt conerning your data loss after the 5s (delay configurable)
Yes, that's what I am afraid of. If some tasks are still present and waiting for processing they will be lost. I am agree that in a normal world 5 secondes would be enough to perform this.