Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » bundle.stop is not firing a bundle change event to a listener plugin
bundle.stop is not firing a bundle change event to a listener plugin [message #530473] Thu, 29 April 2010 17:53 Go to next message
Dilton McGowan II is currently offline Dilton McGowan IIFriend
Messages: 110
Registered: July 2009
Senior Member
Hi,

I have two plugins A and B. B is set to lazy start. A implements
IStartup to guarantee that A moves to an Activated state so it can listen
to BundleChange events for B.

This works and is verifiable using the OSGi console command "ss".

A now creates a BundleListener to listen for B bundle state changes.

When I open a view in B, it moves to the Activated state and A gets
the BundleEvent in its listener:
<snippet>

@Override
public void bundleChanged(BundleEvent event) {

</snippet>

When I invoke bundle.stop() in B, A does not get the event. Why is that?

I stepped through the stop() code in Eclipse and in this section
of code in org.eclipse.osgi.framework.eventmgr.EventManager found
that the listenerObject at one point is set to my A plugin. I stepped
through for a while and mistakenly stepped out.

<snippet>

static void dispatchEvent(Set/*<Map.Entry<Object,Object>>*/
listeners, EventDispatcher dispatcher, int eventAction, Object
eventObject) {
for (Iterator iter = listeners.iterator(); iter.hasNext
();) { /* iterate over the list of listeners */
Map.Entry listener = (Map.Entry) iter.next();
Object eventListener = listener.getKey();
Object listenerObject = listener.getValue();
try {
/* Call the EventDispatcher to complete
the delivery of the event. */
dispatcher.dispatchEvent(eventListener,
listenerObject, eventAction, eventObject);
} catch (Throwable t) {

</snippet>

Any ideas why bundle.stop() is not firing any bundle events to the
listener?

Thanks,
Dilton
Re: bundle.stop is not firing a bundle change event to a listener plugin [message #530498 is a reply to message #530473] Thu, 29 April 2010 20:08 Go to previous message
Dilton McGowan II is currently offline Dilton McGowan IIFriend
Messages: 110
Registered: July 2009
Senior Member
On Thu, 29 Apr 2010 17:53:15 +0000, Dilton wrote:

> Any ideas why bundle.stop() is not firing any bundle events to the
> listener?

I debugged this down a little further into ListenerQueue. In the
following method the "put" operation is skipped when the listener
is my A BundleListener plugin from the OP:

public synchronized void queueListeners(Set/
*<Map.Entry<Object,Object>>*/listeners, EventDispatcher dispatcher) {
if (readOnly) {
throw new IllegalStateException();
}

if (listeners.size() != 0) {
queue.put(listeners, dispatcher); // enqueue the
list and its dispatcher
}
}

Is this a bug?

Dilton
Previous Topic:Which version of platform would you use for a new development?
Next Topic:New Java Project Wizard's Icon Not Showing
Goto Forum:
  


Current Time: Thu Apr 25 23:20:44 GMT 2024

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

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

Back to the top