You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Gary D. Gregory (Jira)" <ji...@apache.org> on 2023/10/18 13:02:00 UTC

[jira] [Commented] (LOGGING-186) Use ServiceLoader class

    [ https://issues.apache.org/jira/browse/LOGGING-186?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17776649#comment-17776649 ] 

Gary D. Gregory commented on LOGGING-186:
-----------------------------------------

PRs welcome: -)

> Use ServiceLoader class
> -----------------------
>
>                 Key: LOGGING-186
>                 URL: https://issues.apache.org/jira/browse/LOGGING-186
>             Project: Commons Logging
>          Issue Type: Bug
>    Affects Versions: 1.2
>            Reporter: Piotr Karwasz
>            Priority: Major
>
> The current service loader code used by {{LogFactory}} predates the {{ServiceLoader}} class introduced in Java 6 by 4 years and is a simplified version of it.
> This has many disadvantages:
> * the service loader file can *not* have any comments, like a license header or the name of the tool that generated the service file. Commons Logging just takes the first line in the file and uses it as the class name,
>  * the Service Loader Mediator OSGi specification allows to use {{ServiceLoader}} in an OSGi environment, but it might ignore direct accesses to {{META-INF/services}} resources (cf. [Apache Aries SPI Fly|https://aries.apache.org/documentation/modules/spi-fly.html]),
>  * in a JPMS environment, the {{META-INF/services}} file could even not be there and the service is declared in the module descriptor.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)