Loading of custom DockerCmdExecFactory by sabre1041 · Pull Request #83 · docker-java/docker-java
The DockerCmdExecFactory is accessed through the Java ServiceLoader. However, there are situations especially in an OSGi environment where the default implementation may not be available due to different classpath architectures.
The DockerClientBuilder does allow for a custom DockerCmdExecFactory to be specified, but only after attempting to load the default. An exception is thrown if the default is not found, otherwise the factory is set and initiated.
If a custom implementation is specified, initialization occurs twice (once for the default and subsequently for the custom implementation). This PR initiates the DockerCmdExecFactory in the DockerClient once at build time