Warning: To avoid potential deadlock, operations that may block, such as
2009-11-11 12:16
423 查看
Warning: To avoid potential deadlock, operations that may block, such as
networking, should be performed in a different thread than the
commandAction() handler.
开发j2me出现的网络连接异常,该异常的意思就是说: 如果你没有使用一个单独的线程来做连接的话,那么该程序就可能出现 潜在的死锁,操作可能会阻塞...
解决办法: 为连接开辟一个新的线程:
方法一:
Runnable runnable = new Runnable
{
public void run()
{
do();
}
}
new Thread(runnable ).start();
在类中加入方法do()
在这个方法中完成网络连接的工作。
方法二:
new Thread(){
public void run(){
do();
}
}.start();
注意:在 run 内部使用外部的 this ,也就是外部的对象不能直接 this, 您可以用 外部的类名.this
networking, should be performed in a different thread than the
commandAction() handler.
开发j2me出现的网络连接异常,该异常的意思就是说: 如果你没有使用一个单独的线程来做连接的话,那么该程序就可能出现 潜在的死锁,操作可能会阻塞...
解决办法: 为连接开辟一个新的线程:
方法一:
Runnable runnable = new Runnable
{
public void run()
{
do();
}
}
new Thread(runnable ).start();
在类中加入方法do()
在这个方法中完成网络连接的工作。
方法二:
new Thread(){
public void run(){
do();
}
}.start();
注意:在 run 内部使用外部的 this ,也就是外部的对象不能直接 this, 您可以用 外部的类名.this
相关文章推荐
- Warning: To avoid potential deadlock, operations that may block...
- WARNING: Calls to any function that may require a gradient calculation inside a conditional block may return undefined results
- #Redis Error #MISCONF Redis is configured to save RDB snapshots, but is currently not able to persist on disk. Commands that may modify the data set are disabled. Please check Redis logs for details a
- mysqlAB复制报[Warning] Statement may not be safe to log in statement format
- pydev debugger: warning: trying to add breakpoint to file that does not exist
- Warning: bind(): React component methods may only be bound to the component instance. See ...
- 123.You used the IMMEDIATE option to shut down your database instance. Consider the steps that may o
- BeautifulSoup4出现警告:To get rid of this warning, change code that looks like this:BeautifulSoup(YOUR_M
- MISCONF Redis is configured to save RDB snapshots, but is currently not able to persist on disk. Commands that may modify the data set are disabled. Please check Redis logs for details about the error
- MISCONF Redis is configured to save RDB snapshots, but is currently not able to persist on disk. Commands that may modify the data set are disabled. Please check Redis logs for details about the error
- Android Warning not all local changes may be shown due to an error
- Sharepoint Error : The URL "filename" is invalid. It may refer to a nonexistent file or folder, or refer to a valid file or folder that is not in the current Web
- Ch4.8: find all the path that a Binary tree sums up to a given value, may/maynot have parent pointer
- 消灭Warning 'ClassName' may not respond to '-funcName:args'
- 当IE向服务器发送数据的时候,这些数据是IE从哪里取得的呢?To block, or not to block? That is the question.
- error C4996: Function call with parameters that may be unsafe - this call relies on the caller to check that the passed values are correct
- What causes javac to issue the “uses unchecked or unsafe operations” warning
- the steps that may be taken to solve a feature selection problem:特征选择的步骤
- Warning not all local changes may be shown due to an error(IDEA Bug) IDEA不能检查到代码变化
- How to Build Your Own Blockchain Part 3 — Writing Nodes that Mine and Talk