You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by "Goldstein Lyor (JIRA)" <ji...@apache.org> on 2018/08/24 15:44:00 UTC

[jira] [Created] (SSHD-841) Use Nio2ServiceFactoryFactory as the hardwired default if no other found or explicitly set

Goldstein Lyor created SSHD-841:
-----------------------------------

             Summary: Use Nio2ServiceFactoryFactory as the hardwired default if no other found or explicitly set
                 Key: SSHD-841
                 URL: https://issues.apache.org/jira/browse/SSHD-841
             Project: MINA SSHD
          Issue Type: Improvement
    Affects Versions: 2.0.1
            Reporter: Goldstein Lyor
            Assignee: Goldstein Lyor


The current code uses {{ServiceLoader#load}} mechanism to detect any 3rd party provided {{IoServiceFactoryFactory}}-ies. However, since {{Nio2ServiceFactoryFactory}} is always present in the {{sshd-core}}, it is always picked up along with any others that the user may have placed in the classpath. Furthermore, the service loading mechanism makes no guarantees as to the order in which registered services are scanned. Since the mechanism that instantiates the factory uses the "first" detected factory it is pretty much useless - unless the user configures the {{org.apache.sshd.common.io.IoServiceFactoryFactory}} system property.

The correct flow should be:

* Consult {{org.apache.sshd.common.io.IoServiceFactoryFactory}} system property
* If no specific factory specified - scan the service loaders
* If *exactly* one found then use it - fail if multiple ones registered
* Otherwise use {{Nio2ServiceFactoryFactory}} 



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)