![](https://img-blog.csdnimg.cn/20201014180756928.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
Java Multi-thread
文章平均质量分 75
海world
青蛙
展开
-
线程对象的几个重要的方法
[url=http://www.java2000.net/p8564]原文链接:线程对象的几个重要的方法[/url] 首先我们接基础篇(二)来说明start()方法。 一个线程对象生成后,如果要产生一个执行的线程,就一定要调用它的start()方法.在介绍这个方法时不得不同时说明run方法.其实线程对象的run方法完全是一个接口回调方法,它是你这个线程对象要完成的具体逻辑.简单说你要...原创 2009-07-30 00:14:40 · 72 阅读 · 0 评论 -
wait、sleep、notify、notifyAll……
[b]wait()[/b] Causes the current thread to wait until either another thread invokes the notify()method or the notifyAll() method for this object, or a specified amount of time has elapsed. The curren...2009-07-30 00:37:25 · 64 阅读 · 0 评论 -
谈谈Runnable接口和Thread
[align=center][b]Runnable接口[/b][/align] public interface RunnableRunnable [list] [*]接口应该由那些打算通过某一线程执行其实例的类来实现。类必须定义一个称为 run 的无参数方法。 [*]设计该接口的目的是为希望在活动时执行代码的对象提供一个公共协议。例如,Thread 类实现了 Runnable。激活的意思...原创 2009-07-31 11:18:37 · 72 阅读 · 0 评论 -
java中yield(),sleep()以及wait()的区别
原文地址:http://hi.baidu.com/qiubaiwei/blog/item/480fe2ee7cdaff1efcfa3cf0.html java中yield(),sleep()以及wait()的区别 从操作系统的角度讲,os会维护一个ready queue(就绪的线程队列)。并且在某一时刻cpu只为ready queue中位于队列头部的线程服务。 但是当前正在被服务的线...原创 2009-08-02 02:23:15 · 75 阅读 · 0 评论 -
java.lang.Thread.State类详解
[b]public static enum Thread.Stateextends Enum[/b]线程状态。线程可以处于下列状态之一: [b][color=green]1.NEW[/color][/b] 至今尚未启动的线程的状态。 [b][color=green]2.RUNNABLE[/color][/b] 可运行线程的线程状态。处于可运行状态的某一线程正在 Java 虚拟机中...2009-08-02 10:25:11 · 111 阅读 · 0 评论 -
ThreadLocal
原文地址:[url]http://blog.csdn.net/qjyong/archive/2008/03/08/2158097.aspx[/url] [b]ThreadLocal是什么?[/b] 早在JDK 1.2的版本中就提供java.lang.ThreadLocal,ThreadLocal为解决多线程程序的并发问题提供了一种新的思路。使用这个工具类可以很简洁地编写出优美的多线程程序。...原创 2009-08-05 00:24:42 · 115 阅读 · 0 评论