Solved

BlackBerry sqLite Multithreading

Posted on 2012-12-27
1
674 Views
Last Modified: 2013-11-24
I am trying to create an application which has multiple threads running in background. In total there would be 5 threads including UI thread and all would be editing and reading database.

I have created a static final object to be used for synchronization purpose.

For each SQL statement i am enclosing it in

synchronized (GlobalVariables.lockObject) {
//// Create or Open Database
//// Create Statement
//// Prepare Statment & Execute
//// Close Database
//// lockObject.notify()

}

Theoritically i belive this should work in multithreading environment. However it doesnt. It works for UI thread but then it waits indefinately at prepare statement for background thread at random places in my code and doesnt move ahead until i take some action in UI thread which makes some database operation.

When my thread goes into waiting mode it stucks at SQLite Pending Operation and doesnt move until i my app does any other database transaction in UI Thread.

I am creating and closing db connection for each database operation in UI and background threads.

I am not sure if this is the best way to handle multiple thread sqlite operation but so far there is no documentation available in BlackBerry or forums and few links i found in forum suggested the way i mentioned above.

This works perfectly in OS 7.0 but not working in 6.0 simulator and devices.

Can someone help me here? I am really stuck at here since last 4 days.

Thank You
0
Comment
Question by:rigelnet
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 

Accepted Solution

by:
rigelnet earned 0 total points
ID: 38732170
I have found solution.

Apprantly in my case i had a UI element invalidating its parent element in paint method.

Thus UI was going into infinite loop and since in OS 6.0 UI methods takes higher precedence and thread is kept on wait until UI methods are completed it was stucked in thread.

Thanks to all who read this post and tried to help me out.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
egit plugin on eclipse 8 96
maven disable workspace resolution 1 37
java imports not found 4 47
program arguments vs VM arguments 4 26
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.

740 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question