java thread
冲冲
哈哈,大家好,
展开
-
MyThread
package org.sf.thread; /** * wait sleep wait必须在锁里面才可以被唤醒,wait 等待后是可以被唤醒,而sleep等待多长时间就多长时间 * @author sfit0734 * */ public class MyThread { public static void main(String[] args) { Ru原创 2015-03-27 18:26:09 · 2471 阅读 · 0 评论 -
ThreadJoinTest
package org.sf.thread; /** * 线程join * ,当主线程处理完其他的事务后,需要用到子线程的处理结果,这个时候就要用到join();方法了。 * */ public class ThreadJoinTest { private int counter; public class ThreadTesterA implements Runnab原创 2015-03-27 18:26:01 · 680 阅读 · 0 评论 -
ThreadNotify_Pro_Con
package org.sf.thread; /** * * 线程通知1 * */ public class ThreadNotify_Pro_Con { public static Object object = new Object(); public static void main(String[] args) { Thread1原创 2015-03-27 18:27:04 · 578 阅读 · 0 评论 -
ThreadNotify_Pro_Con2
package org.sf.thread; import java.util.PriorityQueue; /** * 线程通知2 ThreadN Notify * */ public class ThreadNotify_Pro_Con2 { private int queueSize = 10; private PriorityQueue queue原创 2015-03-27 18:26:52 · 444 阅读 · 0 评论 -
ThreadNotify_Pro_Con3
package org.sf.thread; import java.util.PriorityQueue; import java.util.concurrent.locks.Condition; import java.util.concurrent.locks.Lock; import java.util.concurrent.locks.ReentrantLock; public原创 2015-03-27 18:27:56 · 469 阅读 · 0 评论