I've added you to the ops4j team, so feel free to pull in the changes yourself.
On Thu, Oct 6, 2011 at 06:58, Jarek Gawor < reply+i-1831053-766d8f8a5c4dd88450b2b7eaf770d60ba5a30...@reply.github.com>wrote: > OSGIPaxLoggingManager.getLogger() can be a performance problem. There are > two main issues: 1) it is overly synchronized, and 2) > BundleHelper.getCallerBundle() calls can be expensive. > > 1. Right now the entire getLogger() function is synchronized. Since all log > factory instances (of the same type) share the same instance of > OSGIPaxLoggingManager, all "getLogger()" type of calls are essentially > synchronized on the same monitor. That means that > BundleHelper.getCallerBundle() is called under the monitor and that call > itself can be an expensive operation. > Since there is no need to call BundleHelper.getCallerBundle() under a > monitor removing the synchronized keyword on the getLogger() method will > improve performance. The update to m_loggers map is already properly > synchronized. > > 2. BundleHelper.getCallerBundle() can be an expensive operations since it > uses reflection to get a bundle associated with a class. I assume the code > was written to use reflection so it could work on older frameworks that do > not support the FrameworkUtil.getBundle(Class) call. > I modified the code to use & compile against newer OSGi API that support > the FrameworkUtil.getBundle(Class) so that when running on a newer framework > there is no performance penalty (i.e. no reflection calls). And when running > on an older framework things will work just like before. > > > You can merge this Pull Request by running: > > git pull https://github.com/jgawor/org.ops4j.pax.logging master > > Or you can view, comment on it, or merge it online at: > > https://github.com/ops4j/org.ops4j.pax.logging/pull/6 > > -- Commit Summary -- > > * remove uncesssary synchronization > * optimize for newer frameworks / avoid reflection > > -- File Changes -- > > M > pax-logging-api/src/main/java/org/ops4j/pax/logging/OSGIPaxLoggingManager.java > (2) > M > pax-logging-api/src/main/java/org/ops4j/pax/logging/internal/BundleHelper.java > (48) > M pom.xml (4) > > -- Patch Links -- > > https://github.com/ops4j/org.ops4j.pax.logging/pull/6.patch > https://github.com/ops4j/org.ops4j.pax.logging/pull/6.diff > > -- > Reply to this email directly or view it on GitHub: > https://github.com/ops4j/org.ops4j.pax.logging/pull/6 > -- ------------------------ Guillaume Nodet ------------------------ Blog: http://gnodet.blogspot.com/ ------------------------ Open Source SOA http://fusesource.com
_______________________________________________ general mailing list general@lists.ops4j.org http://lists.ops4j.org/mailman/listinfo/general