Skip to main content

Deadlock and Threads Problem

3 replies [Last post]
Joined: 2007-07-18
Points: 0

gud day!

I have a MIDlet that utilizes the JSR 75 File Connection. (reads/writes a file)

Aside from security warnings, the app works fine in Nokia emulator and real phones

But for Sony Ericsson emulator, I got the deadlock message "Warning: To avoid potential deadlock, ...".

So I have to use the "threading technique" that most of the guys on the net suggested:
//inserting the code in a separate thread inside the commandAction method:

new Thread(new Runnable() {
public void run() {
// function call (file connection related)

with that method, the Sony Ericsson emulator has worked properly,
but unluckily, the program still hangs on real devices (tested on K320 and a higher W-series phone).

do you have any idea, suggestions or other threading techniques to solve the problem?

thank you in advance.

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Joined: 2003-06-15
Points: 0

Have you checked to see that where you are pointing to for the file is a valid address?

Different vendors use different locations because they didn't specify the naming convention in the JSR, so obviously that meant phone makers should run amuck using all sorts of special values for their root paths.

FYI... the app I support for our production system uses JSR75 File Connection and runs on Nokia, and SonyEricsson, using much what you have described as your threading solution. So that is why I suspect you may be throwing an exception or just locking up when the system tries to write to the file you have opened. Also the emulator may not do the filepath checking, even between models vendors/makers can't stay consistent.


Joined: 2007-07-18
Points: 0

I have added a "catching"/ error-checking code if the address is invalid (if that's the case) , but it just won't show on real device (sony ericsson) because the phone hangs.

and it think nokia and sony ericsson follow the same File URL naming convention:

For internal memory: "file:///c:/ [+ dir(s)] + filename"
For memory card "file:///e:/ [+ dir(s)] + filename"

Anyways, thanks for the reply.

Joined: 2008-06-18
Points: 0

Even though some mobile vendors use the same file URL naming convention, it is not as simple as that. For example the root directories most likely differ. You could use the list() method of the FileConnection class to find out what directories are available. Note that some mobile devices also restrict what directories that you could access.

Best Regards