2009/3/6 Stuart McCulloch <mccu...@gmail.com> > 2009/3/6 <alexander.ber...@finnova.ch> > >> From time to time I get the following exception when using Apache Felix >> SCR. I am not yet sure if this is a problem of SCR or a framework bug. For >> me it looks like a framework bug caused by the hashCode() function of >> org.apache.felix.framework.ServiceReferenceImpl respectively >> org.apache.felix.framework.ServiceRegistrationImpl. These functions throw a >> IllegalStateException when the ServiceRegistration is not valid anymore. As >> to my understanding hashCode() should never throw an exception and always >> return the same integer value for the same object instance. If this contract >> is violated classes like HashMap will not work correctly, possibly >> introducing memory leaks if the Map (Set or whatever) entries are not >> removed due to changing hash codes or thrown exceptions. >> >> java.lang.IllegalStateException The service registration is no longer >> valid. >> org.apache.felix.framework.ServiceRegistrationImpl getReference >> ServiceRegistrationImpl.java 88 >> org.apache.felix.framework.ServiceReferenceImpl hashCode >> ServiceReferenceImpl.java 87 >> java.util.HashMap removeEntryForKey HashMap.java 548 >> java.util.HashMap remove HashMap.java 538 >> java.util.Collections$SynchronizedMap remove Collections.java 1982 >> org.apache.felix.scr.impl.DependencyManagerun getService >> DependencyManager.java 578 >> org.apache.felix.scr.impl.DependencyManager close >> DependencyManager.java 374 >> org.apache.felix.scr.impl.AbstractComponentManager disableInternal >> AbstractComponentManager.java 589 >> org.apache.felix.scr.impl.AbstractComponentManager disposeInternal >> AbstractComponentManager.java 616 >> org.apache.felix.scr.impl.AbstractComponentManager dispose >> AbstractComponentManager.java 272 >> org.apache.felix.scr.impl.ImmediateComponentManager dispose >> ImmediateComponentManager.java 120 >> org.apache.felix.scr.impl.BundleComponentActivator dispose >> BundleComponentActivator.java 261 >> org.apache.felix.scr.impl.Activator disposeComponents Activator.java >> 264 >> org.apache.felix.scr.impl.Activator bundleChanged Activator.java 177 >> org.apache.felix.framework.util.EventDispatcher >> invokeBundleListenerCallback EventDispatcher.java 745 >> org.apache.felix.framework.util.EventDispatcher fireEventImmediately >> EventDispatcher.java 674 >> org.apache.felix.framework.util.EventDispatcher fireBundleEvent >> EventDispatcher.java 587 >> org.apache.felix.framework.Felix fireBundleEvent Felix.java 3629 >> org.apache.felix.framework.Felix _stopBundle Felix.java 2076 >> org.apache.felix.framework.Felix stopBundle Felix.java 2034 >> org.apache.felix.framework.BundleImpl stop BundleImpl.java 418 >> org.apache.felix.framework.BundleImpl stop BundleImpl.java 405 >> org.apache.felix.shell.impl.StopCommandImpl execute >> StopCommandImpl.java 70 >> org.apache.felix.shell.impl.Activator$ShellServiceImpl executeCommand >> Activator.java 276 >> org.apache.felix.shell.remote.Shell run Shell.java 109 >> java.lang.Thread run Thread.java 619 >> >> Please tell me if I am wrong else I will open a JIRA issue for this >> problem. >> > > I believe this has already been fixed in trunk: a single service reference > is > now cached inside the registration (it uses an inner class) and neither the > registration or the reference now override the hashcode() method >
forgot to mention - the 1.5.0-SNAPSHOT of the Felix framework should have this fix: http://people.apache.org/repo/m2-snapshot-repository/org/apache/felix/org.apache.felix.main/1.5.0-SNAPSHOT > Kind regards >> - Alex >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: users-unsubscr...@felix.apache.org >> For additional commands, e-mail: users-h...@felix.apache.org >> > -- Cheers, Stuart