Facebook
Banner
XMPP JavaScript Library READ MORE

How to deal with "Warning: To avoid potential deadlock, operations that may block, such as ....

J2ME, Sachin Puri, 2011-07-19 16:37:36

 

Error

 

Warning: To avoid potential deadlock, operations that may block, such asnetworking, should be performed in a different thread than thecommandAction() handler.

Introduction 

This is a common error which we encounter in J2ME applications while using Networking functions such as "HttpConnection". The function which calls buit in function "HttpConnection" should be called as a seperat thread reather then calling directly from commandAction()

 

Solutions

call the function in a new thread like give below;

Thread t = new Thread()
{
    public void run()
    { 
        <function-to-be-called>
    }
};
t.start();

Example

Thread t = new Thread()
{
    public void run()
    { 
        myfunction();
    }
};
t.start();

 

Add Your Comment
   
    Yes! I want to receive all comments by email

No Comments Posted Yet. Be the first one to post comment