Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Equinox » ThreadDeath - Servicelistener ???
ThreadDeath - Servicelistener ??? [message #119980] Wed, 22 October 2008 09:48 Go to next message
Eclipse UserFriend
Originally posted by: a.heikhaus.cenit.de

Hi,

I use osgi services for different useful thinks in my rcp app. e.g. one persistservice for persisting objects. Now I have the usecase that I have to persist some objects if the platform will be closed. So I firstly tried to do that in method stop() of my activator. But unfortunately the service is already unregisterd if this bundle will be stopped. So I implemented a servicelistener that listens on deregister events of that persistservice. If such an event occured I then persist my objects in the servicelistener. Now the problem: If I do some short thinks, all works fine. But if the persisting lasts too long then I get the attached error. My question: What happens there? Some suggestions how I can get rid of that problem?

Thanks.


java.lang.ThreadDeath
at java.lang.Thread.stop(Thread.java:698)
at org.springframework.osgi.extender.internal.util.concurrent.R unnableTimedExecution.execute(RunnableTimedExecution.java:68 )
at org.springframework.osgi.extender.internal.ContextLoaderList ener.shutdown(ContextLoaderListener.java:487)
at org.springframework.osgi.extender.internal.ContextLoaderList ener$ContextBundleListener.handleEvent(ContextLoaderListener .java:189)
at org.springframework.osgi.extender.internal.ContextLoaderList ener$BaseListener.bundleChanged(ContextLoaderListener.java:1 24)
at org.eclipse.osgi.framework.internal.core.BundleContextImpl.d ispatchEvent(BundleContextImpl.java:1234)
at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEve nt(EventManager.java:211)
at org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEv entSynchronous(ListenerQueue.java:141)
at org.eclipse.osgi.framework.internal.core.Framework.publishBu ndleEventPrivileged(Framework.java:1518)
at org.eclipse.osgi.framework.internal.core.Framework.publishBu ndleEvent(Framework.java:1469)
at org.eclipse.osgi.framework.internal.core.Framework.shutdown( Framework.java:667)
at org.eclipse.osgi.framework.internal.core.Framework.close(Fra mework.java:576)
at org.eclipse.osgi.framework.internal.core.OSGi.close(OSGi.jav a:41)
at org.eclipse.core.runtime.adaptor.EclipseStarter.shutdown(Ecl ipseStarter.java:420)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:200)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcce ssorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMe thodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java: 549)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:504)
at org.eclipse.equinox.launcher.Main.run(Main.java:1236)
at org.eclipse.equinox.launcher.Main.main(Main.java:1212)
Re: ThreadDeath - Servicelistener ??? [message #120006 is a reply to message #119980] Wed, 22 October 2008 14:01 Go to previous messageGo to next message
Ignacio M is currently offline Ignacio MFriend
Messages: 20
Registered: July 2009
Junior Member
This is a thought a suggestion, what if you start all your services in one
thread, this thread will do a wait() when all services are up and running,
then in a stop method you will call notify() to close all your services,
but before close your services you could do some tasks before.
Re: ThreadDeath - Servicelistener ??? [message #120071 is a reply to message #120006] Thu, 23 October 2008 12:32 Go to previous message
Eclipse UserFriend
Originally posted by: a.heikhaus.cenit.de

Thanks for your reply, but I think it does not help me, because I don´t want to handle the lifecycle of the services by myself.

I now finally used a ServiceTracker, because I´ve read some things about concurrency - problems with ServiceListener. But the problems stays the same. May be some of you can give me a hint when watching the source code. The following is one method of my ServiceTrackerCustomizer:

public class Customizer implements ServiceTrackerCustomizer {

		public Object addingService(ServiceReference reference) {
			return reference;
		}

		public void modifiedService(ServiceReference reference, Object service) {

		}

		public void removedService(ServiceReference reference, Object service) {
			
			try {
				Thread.sleep(15000);
			}
			catch (InterruptedException e) {
				e.printStackTrace();
			}

		}
	}


This is just to simplify. If I use 150 millis in sleep() method then all works fine. If I use 15000 then the error occurs. I also found out, that it also happens when I just stop only the service bundle. So I ask by myself: Is that a bug? Or is it forbidden to do some intensive work here? What can I do to handle my usecase? Noone ever heard of that problem? A lot of questions.......

Thanks.
Previous Topic:Managing Equinox Instances
Next Topic:p2 - fragments for IU
Goto Forum:
  


Current Time: Mon Nov 11 08:41:04 GMT 2024

Powered by FUDForum. Page generated in 0.02893 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top