Warning: To avoid potential deadlock, operations that may block...
来源:互联网 发布:mac重装系统失败 编辑:程序博客网 时间:2024/06/07 23:39
Warning: To avoid potential deadlock, operations that may block, such as networking, should be performed in a different thread than the commandAction() handler.
手机中,所有的MIDlet程序都是由Application Manager Software(AMS)管理的。当MIDlet初始化后,AMS就会调用MIDlet的startApp()方法,此时MIDlet就进入了Acitive状态。在JAVA ME中有些操作可能会导致程序堵塞,比如连接网络等。如果这些操作与主程序在同一个主线程中完成,那么由于堵塞会造成程序长时间无法返回,也就无法响应用户的其他操作了。所以,如果我们在commandAction()中进行了联网的操作,则会造成如上所述的情况。
将调用操作的地方去new 一个Thread ,然后在Run方法里写调用函数:
new Thread(){public void run(){try{do();//调用操作}catch(Exception e){}}}.start();
- Warning: To avoid potential deadlock, operations that may block...
- MPI-Avoid deadlock
- Solution to DeadLock
- How to prevent LUA scripts that block your program
- What causes javac to issue the “uses unchecked or unsafe operations” warning
- How to avoid Conflict
- the steps that may be taken to solve a feature selection problem:特征选择的步骤
- warning C4996: 'scanf': This function or variable may be unsafe. Consider using scanf_s instead. To
- Warning: bind(): React component methods may only be bound to the component instance. See ...
- pydev debugger: warning: trying to add breakpoint to file that does not exist
- Lesson 12 Using block operations
- problems that may cause a
- How to deal with deadlock.
- WARNING ITMS-90076: "Potential Loss of Keychain Access."
- mssql出错:A SELECT statement that assigns a value to a variable must not be combined with data-retrieval operations.
- Java Deadlock Example – How to analyze deadlock situation
- Using Handler to Avoid ANR
- How to avoid "sudo minicom"
- arm-linux-gcc-4.3.2.tgz安装方法
- error LNK2019: unresolved external symbol
- 分析表与索引
- 数据结构基础1
- php 数组与js 数组转换
- Warning: To avoid potential deadlock, operations that may block...
- 做iphone ui需要的一个图片
- 工作札记(二):设置Embeded QT程序鼠标指针为透明
- Ascii码表
- Linux上的free命令详解
- CISCO ASA5505在只有一个公网地址的情况下,做内部服务器端口映射供外网访问!!
- 为程序员量身定制的12个目标
- XML与DataSet的相互转换类
- 计算机经典书籍