All ssems good right? Actually, when you ask to Java Service Loader first Printer and then Scanner, even if you have a sigle implementation for both interfaces, you will get two different instances.
Unlock the full InfoQ experience by logging in! Stay updated with your favorite authors and topics, engage with content, and download exclusive resources. Dany Lepage discusses the architectural ...
However, ServiceLoader is not thread-safe according to the docs so this incorrectly uses a ServiceLoader across multiple threads. In particular, I'm getting a NoSuchElementException when using ...
Results that may be inaccessible to you are currently showing.
Hide inaccessible results