01-13-2010 11:45 AM
There are no errors in the logs, just the device freezes. A DialogClosedListener won't work -- the Runnable never gets executed, so the Dialog never gets displayed.
Haven't tried it on an actual device (myself) but everybody that has my software on OS 5.0 says that outgoing emails do not work (as I intercept them with the SendListener).
01-13-2010 12:50 PM
What happens if you change getEventLock to getAppEventLock in the sync block?
Personally, I've had best results using a DialogClosedListener with global screens.
Since you mentioned that you were able to display the screen using the code in the KB, I would combine that method with a DialogClosedListener to see if you can get the result.
01-13-2010 02:19 PM
It's only able to display the screen in the KB articles because the ones there don't wait for a response. What happens is the invokeLater is executed and doesn't block, so the SendListener continues on its merry way. Once it's has completed and returned from the SendListener, the invokeLater is THEN run (which is too late, as I depend on that Dialog's response on determining what the SendListener should do).
The issue is that the invokeAndWait blocks and the Runnable inside of it never gets run -- this is causing the device to freeze inside the mail app (but I can enter the ribbon and go to another app or desktop). Again, the DialogClosedListener won't work in this instance because the response from the Dialog is needed for the SendListener response (i.e.: the Dialog doesn't get shown, so the DialogClosedListener would never get run. I would need to block for it anyways, before the SendListener could return a boolean from sendMessage).
But thanks for trying to think of a solution.
01-13-2010 02:57 PM
Initially I agreed that you could not, but in fact I think you might be able to use DialogClosedListener. But I have been checking on other things, and I note that in OS 4.2.1 and OS 5.0, the listener is called from a UiApplication. However in OS 5.0 it is not called with the Event Thread, but is in OS 4.2.1. I'm working on this to see detecting this and processing differently provides the answer. However I wonder if anyone else would like to try another OS and see if the listener is running with the Event Thread.
Application ourapp = Application.getApplication();
System.out.println("In Event: " + ourapp.isEventThread());
System.out.println("IS UiApplication: " + (ourapp instanceof UiApplication));
01-13-2010 05:39 PM - edited 01-14-2010 04:21 AM
I think I've made some progress here.
Don't know if you have ever seen this KB article:
How to - Detect a deadlock using the JDE
Article Number: DB-00572
Well I just tried this on OS 5.0 and got the following:
Interlaced sync objects:
Synch object A: @06884800 - java.lang.Object
Synch object B: @041F2400 - net.rim.device.api.collection.CollectionLock
synchronized( B ): EmailMessageSender.run( ) [source code is not available]
synchronized( A ): MySendListener.sendMessage( Message ) [ourUiApp.pushGlobalScreen( dialog,]
Some other thread in the past (no stack available):
synchronized( A ): Application.doProcessNextMessage( Message ) [source code is not available]
synchronized( B ): MessageListUI.isSeparator( int ) [source code is not available]
This locked up on the synchronize for the Event Lock. To me, this suggests that some other Thread has the Event Lock, and is waiting for this Thread to finish and free up a lock, but we can't finish until we know whether to send it or not, and to do that we need the Event Lock. We are screwed.
I think you will have to raise this on issue tracker.
01-27-2010 07:48 AM
Posted this on the issue tracker two weeks ago. What's the general timeframe on hearing something back about it? It's still in 'Triage' state and I haven't heard anything.
(Issue at https://www.blackberry.com/jira/browse/JAVAAPI-771 for anyone to see.)
01-27-2010 07:50 PM
I think it has to do with priority, I have 2 low priority entries that where last "updated" months ago.
02-03-2010 07:31 AM
Priority is "Blocker", for the obvious reason that the bug causes my application to freeze the device with a deadlock. At least now it's been assigned, but I still see no progress on it -- it's still in "Triage".
02-04-2010 02:51 PM
I have a very similar application trying to capture user response to an alert displayed by my application in SendListener SendMessage() function.
The code works fine on 4.2 to 4.6 devices. Just started testing it on 9700 (OS5.0) and it doesn't work.