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
Regular Contributor
nunonobre
Posts: 64
Registered: ‎09-21-2011
My Device: Curve & 8520
My Carrier: TMN

Re: Queue too large

Hi,
I'm using Synchronized on the event lock. My code is:

new Thread(){

public void run(){

Logger.logAlwaysEvent("[Contact Customer Care] Number of Threads:" + Thread.activeCount());




Logger.logAlwaysEvent("[Contact Customer Care] inserting json event");
insertJsonEvent(message);
Logger.logAlwaysEvent("[Contact Customer Care] json event inserted");

Logger.logAlwaysEvent("[Contact Customer Care] generating and sending json files to the server...");

int resourceResponse = CONTACT_CUSTOMER_CARE_RESPONSE;
try {
sendJsonToTheServer();
Logger.logAlwaysEvent("[Contact Customer Care] Json files sent.");
} catch (Exception e) {
resourceResponse = CONTACT_CUSTOMER_CARE_ERROR_RESPONSE;
Logger.logAlwaysEvent("[Contact Customer Care] Exception:" + e.getMessage());
}




//synchronized (Application.getEventLock()) {

Logger.logAlwaysEvent("[Contact Customer Care] Dialog to inform customer of response");

UiEngine ui = Ui.getUiEngine();
Screen screen = new Dialog(Dialog.D_OK,
AppMain.getResources().getString(resourceResponse),
Dialog.OK,
Bitmap.getPredefinedBitmap(Bitmap.INFORMATION),
Manager.VERTICAL_SCROLL);
ui.pushGlobalScreen(screen, 1, UiEngine.GLOBAL_QUEUE);
// ui.pushModalScreen(screen);

Logger.logAlwaysEvent("[Contact Customer Care] Dialog was shown");


}


//appMain.contactCustomerCareChangeState();

//}

}.start();
Please use plain text.
Regular Contributor
nunonobre
Posts: 64
Registered: ‎09-21-2011
My Device: Curve & 8520
My Carrier: TMN

Re: Queue too large

I'am using synchronized (Application.getEventLock()).

 

My code is:

 

 

new Thread(){
                
                public void run(){
                    
                    Logger.logAlwaysEvent("[Contact Customer Care] Number of Threads:" + Thread.activeCount());
                    
                    
                    
                    
                    Logger.logAlwaysEvent("[Contact Customer Care] inserting json event");
                    insertJsonEvent(message);
                    Logger.logAlwaysEvent("[Contact Customer Care] json event inserted");
                    
                    Logger.logAlwaysEvent("[Contact Customer Care] generating and sending json files to the server...");
                    
                    int resourceResponse = CONTACT_CUSTOMER_CARE_RESPONSE;
                    try {
                        sendJsonToTheServer();
                        Logger.logAlwaysEvent("[Contact Customer Care] Json files sent.");
                    } catch (Exception e) {
                        resourceResponse = CONTACT_CUSTOMER_CARE_ERROR_RESPONSE;
                        Logger.logAlwaysEvent("[Contact Customer Care] Exception:" + e.getMessage());
                    }
                    
                    
                
                    
                    synchronized (Application.getEventLock()) {
                    
                        Logger.logAlwaysEvent("[Contact Customer Care] Dialog to inform customer of response");
                        
                        UiEngine ui = Ui.getUiEngine();
                        Screen screen = new Dialog(Dialog.D_OK,
                                                   AppMain.getResources().getString(resourceResponse),
                                                   Dialog.OK,
                                                   Bitmap.getPredefinedBitmap(Bitmap.INFORMATION),
                                                   Manager.VERTICAL_SCROLL);
                        ui.pushGlobalScreen(screen, 1, UiEngine.GLOBAL_QUEUE);
//                        ui.pushModalScreen(screen);
                        
                        Logger.logAlwaysEvent("[Contact Customer Care] Dialog was shown");
                        
                        
                    }
                    
                    
                    //appMain.contactCustomerCareChangeState();
                    
                }
                
            }.start();

Please use plain text.
Regular Contributor
nunonobre
Posts: 64
Registered: ‎09-21-2011
My Device: Curve & 8520
My Carrier: TMN

Re: Queue too large

I'am using Synchronized on the event lock. My code is:

 

synchronized (Application.getEventLock()) {
                    
                        Logger.logAlwaysEvent("[Contact Customer Care] Dialog to inform customer of response");
                        
                        UiEngine ui = Ui.getUiEngine();
                        Screen screen = new Dialog(Dialog.D_OK,
                                                   AppMain.getResources().getString(resourceResponse),
                                                   Dialog.OK,
                                                   Bitmap.getPredefinedBitmap(Bitmap.INFORMATION),
                                                   Manager.VERTICAL_SCROLL);
                        ui.pushGlobalScreen(screen, 1, UiEngine.GLOBAL_QUEUE);
//                        ui.pushModalScreen(screen);
                        
                        Logger.logAlwaysEvent("[Contact Customer Care] Dialog was shown");
                        
                        
                    }

Please use plain text.
Regular Contributor
nunonobre
Posts: 64
Registered: ‎09-21-2011
My Device: Curve & 8520
My Carrier: TMN

Re: Queue too large

Sorry for the repeated text. My computer is slow.

Please use plain text.
Developer
mreed
Posts: 1,041
Registered: ‎07-16-2008
My Device: ಠ_ಠ

Re: Queue too large

If you comment out the ui portion, do you still get the error? We need to rule it out.

Please use plain text.
Regular Contributor
nunonobre
Posts: 64
Registered: ‎09-21-2011
My Device: Curve & 8520
My Carrier: TMN

Re: Queue too large

No, if I comment I doesn't have this error. If I add too many screen to the Global screen it could be the reason for that? Maybe the user execute this action too many times.
Please use plain text.
Developer
mreed
Posts: 1,041
Registered: ‎07-16-2008
My Device: ಠ_ಠ

Re: Queue too large

Could be. Not sure what your screen is for, but it doesn't sound like it should be displaying so many, so maybe you should add some check to make sure the action doesn't run multiple times?

Please use plain text.