My tip is essentially to just try to start your thread before the
calling thread gets the locks in question.
If that is not possible, you will have to look at which locks it
acquires. If they are part of the locking protocol implemented by Felix,
then you might be able to modify them to make them transferable in some
way to your thread while it calls the activator. If they are sync block
locks, then you are out of luck.
Of course, you are making an assumption that all thread creation happens
in the activator, but it may not.
-> richard
On 3/14/09 4:36 PM, João Ferreira wrote:
Hi
Yes Im using trunk code. I got this idea from this previous work [1]
but unfortunately the code is not available.
Im not sure i understand your tips, because im not very familiar with
the code and what the start level is supposed to do.
What i need is that the start() method of the bundle is executed by a
thread that belongs to a ThreadGroup for that bundle so the threads
created in the start() method belong to that ThreadGroup. After this i
still need to isolate the services in different threads so the
accounting is done properly.
I will study those lock mechanisms better and then i tell u the results.
Thanks
João
[1]http://www.vtt.fi/inf/pdf/publications/2008/P685.pdf
Richard S. Hall wrote:
I am not sure what you want to do is possible.
At a minimum, you would have to do your hand off before the start
level thread acquires the locks. If the start level thread is only
acquiring lock objects, you could potentially modify them to make
them transferable to another thread, but this would be tricky and if
the thread is holding any synchronized block locks, then this
approach wouldn't work.
This will be difficult. Make sure you are looking at the trunk code,
since the locking code has changed a lot since the last release.
-> richard
On 3/14/09 4:01 PM, João Ferreira wrote:
Hi
I'm doing some work in OSGi in an attempt to add better resource
monitoring to osgi applications. My objective is to isolate the cpu
consumption across the different bundles. To implement this my
strategy is to group the different threads in ThreadGroups, where
there is a different ThreadGroup for each bundle.
In the "Felix.startBundle(BundleImpl bundle, boolean record)" method
i create a new thread and a new thread group to call the
"SecureAction.startActivator(BundleActivator activator,
BundleContext context)" method. i start this new thread and wait for
it to die. The problem is i get a deadlock because the startlevel
thread is waiting and holding the lock, and the new thread is trying
acquire the lock to register services (in this case the shell bundle
is registering the shell service). In the actual Felix
implementation the register service method can acquire the lock
because its the same thread.
I would like some help so i dont break the framework. What would be
the best solution to my problem? Release the lock before starting
the new thread and this new thread acquire the lock? Modify the
bundle.isLockable() method to allow other threads to lock?
Thanks in advance
João Ferreira
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]