You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "ppkarwasz (via GitHub)" <gi...@apache.org> on 2023/10/18 18:17:41 UTC
[PR] [LOGGING-186] Replace custom code with `ServiceLoader` call [commons-logging]
ppkarwasz opened a new pull request, #171:
URL: https://github.com/apache/commons-logging/pull/171
This PR replaces the old pre-Java 6 service loader code with a call to the `ServiceLoader` class.
There are a couple of advantages to this change:
- `ServiceLoader` allows for comments in the service loader files, whereas the custom code takes the first line,
- code that uses `ServiceLoader` can automatically work with OSGi bundles (via [Service Loader Mediator](https://docs.osgi.org/specification/osgi.cmpn/7.0.0/service.loader.html)) and JPMS modules (that have a `provides` clause in their descriptor).
In multi-classloader environments service loader files can point to classes that do not implement `LogFactory`, causing a **single** iteration of the service `Iterator` to fail. This code loads the first `LogFactory` implementation that succeeds.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@commons.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [LOGGING-186] Replace custom code with `ServiceLoader` call [commons-logging]
Posted by "garydgregory (via GitHub)" <gi...@apache.org>.
garydgregory commented on PR #171:
URL: https://github.com/apache/commons-logging/pull/171#issuecomment-1769297297
TY @ppkarwasz ! 🥇
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@commons.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [LOGGING-186] Replace custom code with `ServiceLoader` call [commons-logging]
Posted by "garydgregory (via GitHub)" <gi...@apache.org>.
garydgregory merged PR #171:
URL: https://github.com/apache/commons-logging/pull/171
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@commons.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org