Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
Developer
Posts: 510
Registered: ‎05-31-2009
My Device: Not Specified

Name of class for BB Event Queue equivalent

This is a followup to an earlier post. I have an app which stops responding possibly due to an event queue overflow, and I need to see inside the queue to fix it. I haven't been able to find the name of the class. It would be great if someone could post a few lines of code which sees into the event queue for my app by logging say. Cheers, Justin.
Developer
Posts: 4,764
Registered: ‎07-21-2008
My Device: Not Specified

Re: Name of class for BB Event Queue equivalent

There is no such class.

 

The event queue is a system container that is owned by the event dispatcher.

 

I think the answer from the previous thread is still valid: the problem needs to be addressed in your application code.

 

http://supportforums.blackberry.com/t5/Java-Development/EventQueue-in-BB-Java/m-p/383955#M73476

 

 

Developer
Posts: 19,631
Registered: ‎07-14-2008
My Device: Not Specified

Re: Name of class for BB Event Queue equivalent

[ Edited ]

"I need to see inside the queue to fix it." - I've never had to do anything like this to fix a problem with my app.  Run in the Simulator or with the Device attached, and watch the log.  Or use Break now, if you want to know what is going on at  a specific point.  Use the EventLogger (and System.out) at key points in your program to monitor your actions. 

 

This is going to sound silly, but the profiler can actually be an amazingly useful debugging tool too - look at the cycles used and objects created and make sure you can explain the patterns you see and they are what you expect. 

 

Remember that eventually this application is going to be on a user's phone, and when it breaks, it should be easy for you to gather information about where it broke.  Put these in place now while you are attempting to fix this problem.  Getting your user's phone in so that you can attach it to the debugger and look inside the Event Queue is not going to cut it.

 

If you want to know what is the event queue, it can only get there if you do something to the device (press a menu button for example) or use one of the InvokeLater, invokeAndWait or synchronized get\EventLock.  Search these out in your application if you really do think that the Event Thread is causing you a problem.  So rather than searching for it after it has got there, look at what you are putting there first.

 

Finally stopping responding could be something else, like a loop or a deadlock.  Have you any other symptoms that you can share with us.

 

 

Developer
Posts: 510
Registered: ‎05-31-2009
My Device: Not Specified

Re: Name of class for BB Event Queue equivalent

Good advice- as far as synchronized get, I have code like the following piece all over my app:

 

 

            synchronized (store) 
            {
                _data = (Vector) store.getContents();
                if (!_data.isEmpty()) 
                {
                    StoreInfo info = (StoreInfo)_data.lastElement();
                    String lastUpdateDateTime =                         info.getElement(StoreInfo.DATETIMEOFLASTCLOCKUPDATEEVENT);

            // ... etc ...

 

 

Another symptom was that one tester couldn't open my app at one poiint- she clicked the icon and nothing happened.

 

JD.