线程睡眠

来源:互联网 发布:c 二维数组排序 编辑:程序博客网 时间:2024/04/28 15:36

编程测试失效,运用线程睡眠来测试
Thread t = new Thread(“MyThread”);
t.start();
ehCache.put(“ehcache”, “aaa”, “ccc”);
System.out.println(ehCache.get(“ehcache”).get(“bbb”));
try {
t.sleep(10000);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
System.out.println(ehCache.get(“ehcache”).get(“bbb”));
t.interrupt();// 中断t线程

0 0