I'm working on a multi-tenant application which make use of spring `UserCredentialsDataSourceAdapter`, so that each tenant will have an independent database.
I also have independent processEngine for each tenant.
Since there are lot of tenants(500+) and each tenant have its own processEngine there are lot of jobExecutors active in the application, which is causing a performance bottleneck for us. All I want to do is throttle the jobExecutors using an already existing mechanism.
Instead of the jobExecutor running self in every x seconds, I want to trigger the jobExecutor externally using some custom logic(it will take care of throttling).
How can I achieve this?
One of the way I'm looking at is to get hold of the the commandExecutor from the processEngine (using reflection) and then run the AcquireJobsCmd command to get the pending jobs then call the ExecuteJobsRunnable with appropriate parameters (I cannot use the default ExecuteJobsRunnable since it uses a `JobExecutor` and I don't have one).