wwj-go opened a new issue #1546: URL: https://github.com/apache/shardingsphere-elasticjob/issues/1546
Java's native SPI mechanism has the following disadvantages: 1. Cannot be loaded on demand. Although `ServiceLoader `does lazy loading, it can basically only be obtained by traversal, that is, all the implementation classes of the interface have to be loaded and instantiated once. If you do not want to use certain implementation classes, or the instantiation of certain classes is time-consuming, java SPI is not a good choice. 2. The way to obtain a certain implementation class is not flexible enough, it can only be obtained in the form of Iterator, and the corresponding implementation class cannot be obtained according to a certain parameter. In order to realize the function, it is usually necessary to wrap a layer on it, such as `JobItemExecutorFactory`, `JobShardingStrategyFactory`, etc., which is easy to cause duplication of code. 3. It is not safe for multiple concurrent and multithreaded instances to use the `ServiceLoader `class. Based on the above reasons, it is necessary to implement another SPI mechanism to work with elastic-job to solve these problems. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected]
