Fix SshSessionFactory#setInstance to use service loader
If setInstance(SshSessionFactory) is called with parameter null set default session factory using the newly introduced service loader instead of hard-coding the default factory class. Change-Id: I86b5932333cc53b706534a2822e0fd96e12e6e47 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
This commit is contained in:
parent
54b1c7cc6a
commit
7a23fc1250
|
@ -63,10 +63,11 @@ public static SshSessionFactory getInstance() {
|
|||
* default factory will be restored.s
|
||||
*/
|
||||
public static void setInstance(SshSessionFactory newFactory) {
|
||||
if (newFactory != null)
|
||||
if (newFactory != null) {
|
||||
INSTANCE = newFactory;
|
||||
else
|
||||
INSTANCE = new DefaultSshSessionFactory();
|
||||
} else {
|
||||
INSTANCE = loadSshSessionFactory();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue