How to schedule the thread's priority?
来源:互联网 发布:云计算应用的发展方向 编辑:程序博客网 时间:2024/05/21 17:00
1 UI application
The user is boss of the application, so the UI thread has highest priority. workerthread has lower priority.
· Keep the priorityof worker threads low.
· Keep the numberof worker threads small.
· Consider suspending worker threads duringCPU-intensive operations like scrolling.
Key Points
- Using threads is essential for building responsive GUIs. Blocking user activity to wait for long tasks to complete leads to poor perceived performance.
- The user is the boss. Always let your users know what's going on and give them regular status updates when waiting for long tasks to complete.
- Once realized, Swing components should only be touched by code executing inside the AWT event-dispatch thread.
- Use invokeLater and invokeAndWait to move work to the event dispatching thread.
- Use timers for repeated operations. You can use either the javax.swing.Timer or java.util.Timer. The utility Timer class gives you more control, but you have to move work to the event- dispatch thread yourself. You can use the SwingTimerTask utility described in this chapter to move work to the event-dispatch thread.
- Use SwingWorker to execute time-consuming tasks on new threads and update the GUI on the event-dispatch thread.
- Interrupt worker threads when the user is driving the system.
2 Real time server application:
- How to schedule the thread's priority?
- How to schedule and get the report in SCOM2012
- The thread priority in UI application
- How to write the Gridview's RowCommand
- how to use thread
- How to use Thread
- ERROR: Power Handler function yield to low priority thread 解决办法
- ERROR: Power Handler function yield to low priority thread. 解决方法
- How To get the usbdisk's drive letter properly
- How to utilize the application's spare time?
- How to change the ClearCase view's owner and group
- [JNI] How to get the java's native method body?
- How to Realize the Two's Complement of -128?
- How To Fix Xcode's "used as the name of&
- How to check the entitlements on my Application's Signature
- How to solve the issue of RSARTE's starting problem
- How to Stop a Thread
- How to analyze Thread Dump
- cocos2d-x 多个child可以共一个tag
- 初学Android,图形图像之使用双缓冲画图(二十七)
- The Internet Archive
- 2012最新网站手工注入详解教程
- Utf-8编码是如何工作的
- How to schedule the thread's priority?
- 面试,面的不只是求职者
- VirtualBox安装 系统vdi压缩
- 程序员面试100题(算法)之C/C++实现字符串复制
- QTP 11 破解
- Pear 安装注意事项
- C语言病毒
- Android 如何防止代码被反编译
- 美科学家称噬菌体未来可为新型手机电池