IllegalStateException thrown by LogWrapper if logging after bundle stop
-----------------------------------------------------------------------
Key: FELIX-2089
URL: https://issues.apache.org/jira/browse/FELIX-2089
Project: Felix
Issue Type: Bug
Components: Event Admin
Affects Versions: eventadmin-1.2.2
Reporter: Felix Meschberger
Assignee: Felix Meschberger
Fix For: eventadmin-1.2.2
Some Event delivery worker threads may still be running when the Event Admin
bundle is stopped. If such threads try to log through the LogWrapper after that
fact, an IllegalStateException may be thrown as follows:
12.02.2010 18:38:20.279 *ERROR* [Thread-22]
org.apache.sling.extensions.threaddump.internal.Activator Uncaught exception in
Thread Thread[Thread-22,5,main] java.lang.IllegalStateException: Invalid
BundleContext.
at
org.apache.felix.framework.BundleContextImpl.checkValidity(BundleContextImpl.java:393)
at
org.apache.felix.framework.BundleContextImpl.getService(BundleContextImpl.java:316)
at
org.apache.felix.eventadmin.impl.util.LogWrapper.log(LogWrapper.java:208)
at
org.apache.felix.eventadmin.impl.handler.BlacklistingHandlerTasks.blackList(BlacklistingHandlerTasks.java:172)
at
org.apache.felix.eventadmin.impl.tasks.HandlerTaskImpl.blackListHandler(HandlerTaskImpl.java:107)
at
org.apache.felix.eventadmin.impl.tasks.SyncDeliverTasks.execute(SyncDeliverTasks.java:269)
at
org.apache.felix.eventadmin.impl.tasks.AsyncDeliverTasks$TaskExecuter.run(AsyncDeliverTasks.java:110)
at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(Unknown
Source)
at java.lang.Thread.run(Unknown Source)
(Note that the logger name ...Activator is just the logger of an
UncaughtExceptionHandler registered with the Thread class).
The reason for this is, that the BundleActivator.stop() method does not inform
the LogWrapper class, that the BundleContext will be invalidated.
A simple fix is to call the LogWrapper.setBundleContext method with a null
argument to allow the LogWrapper to unregister as a LogService listener and
drop all log service references to continue logging to stdout, if something
would still be coming along.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.