摘要:        
package com.test.thread; public class TestYield { public static void main(String[] args) { TestThread t1 = new TestThread("A_01"); TestThread t2 = new    阅读全文
posted @ 2017-07-12 16:52
蜜獾互联网
阅读(5)
评论(0)
推荐(0)
        
            
        
        
摘要:        
在JDK中,定义了wait(), notify()和notifyAll()等接口。wait()的作用是让当前线程进入等待状态,同时,wait()也会让当前线程释放它所持有的锁。而notify()和notifyAll()的作用,则是唤醒当前对象上的等待线程;notify()是唤醒单个线程,而notif    阅读全文
posted @ 2017-07-12 16:24
蜜獾互联网
阅读(12)
评论(0)
推荐(0)
        
            
        
        
摘要:        
Sleep():在指定的毫秒数内让当前正在执行的线程休眠 调用sleep方法时使当前的线程进入休眠状态(阻塞状态)设定休眠xxxx毫秒数后进入运行状态 同步块中的Sleep方法调用 不会释放对象锁但调用wait()方法会释放对象的同步锁 package com.test.thread; public    阅读全文
posted @ 2017-07-12 15:43
蜜獾互联网
阅读(17)
评论(0)
推荐(0)
        
            
        
        
摘要:        
代码: package com.test.thread; public class TestRunnable implements Runnable{ @Override public void run() { synchronized (this) { for (int i = 0; i < 10    阅读全文
posted @ 2017-07-12 15:07
蜜獾互联网
阅读(4)
评论(0)
推荐(0)
        
 
                     
                    
                 
                    
                
 
         浙公网安备 33010602011771号
浙公网安备 33010602011771号