Java????????
???????????? ???????[ 2016/9/6 10:53:11 ] ????????Java ???
???????sleep??????wait??????suspend??????????
???????????
????sleep??Thread???????????????????????????????????????????????????????д????????????????????print?????????????sleep????????????????Ρ????????????? sleep() ????????????????????????л????????????????????????????????????????????????sleep??????????????
????wait??Object????????????????????????????????????и????????????????????????????notify?????????????????????????????????????????????????????????????????????????? ???????wait()???????±????????????????????????????????????????????????notify????????notifyAll???????????????????????????????????????????
????????? ??
????????wait????????????????????????????????????????????????в???????????????????????????????wait???????????????????????????????????????????????????????????????????????????????A????????????????????wait?????????A??????????????????jVM????????????????y??????
????????sleep??????????????????sleep????????????????????????????????漰????????????????????????A?????????????????????????sleep??????????????????????????????????????????????????????????????????????????
????suspend() ?????????????????????suspend()?????????????????????????????????????????????????????κ????????????????????????????"????"??????????С????κ??????????????????????????????????????κ????????????????????????
??????????????£????????????????????
????1. ????????????顣
????2. ??????????????????У?????????????????????
????3. ??????????????????У????????????????wait()???????????????????????ж?????????
??????????????£???????????У??????????????????
????1. ??????????????????У??????Thread.sleep()???????????????CPU???????????????в??????????
????2. ??????????????????У??????Thread.yield()???????????????CPU???????????????
????3. ??????????????????У????????????????????suspend()???????????????????????????????
?????塢????????????????
????JAVA???????????????????????????????
????????????????????????"Class”???????????????????????????????????????????????????????????????????????????????????????κξ???????????????????????????????????????????????????????????????????????£?
????public class Common implements Runnable {
????public synchronized static void method1() throws InterruptedException {
????Thread.sleep(1000);
????System.out.println("Method 1 called");
????Thread.sleep(1000);
????System.out.println("Method 1 done");
????}
????public synchronized static void method2() throws InterruptedException {
????Thread.sleep(1000);
????System.err.println("Method 2 called");
????Thread.sleep(1000);
????System.err.println("Method 2 done");
????}
????public void run() {
????System.out.println("Running " + Thread.currentThread().getName());
????try {
????if (Thread.currentThread().getName().equals("Thread-1")) {
????method1();
????} else {
????method2();
????// Thread.currentThread().notify();
????}
????} catch (Exception e) {
????e.printStackTrace();
????}
????}
????public static void main(String[] args) throws InterruptedException {
????//???′????????????????????????????????????????????????
????Common c1 = new Common();
????Common c2 = new Common();
????Thread t1 = new Thread(c1?? "Thread-1");
????Thread t2 = new Thread(c2?? "Thread-2");
????t1.start();
????t2.start();
????}
????}
??????н?????£?
????Running Thread-2
????Running Thread-1
????Method 2 called
????Method 2 done
????Method 1 called
????Method 1 done
??????????????????????????????????????????????????????????????
??????????????????????????????????????????????????????????????????÷??????????????????????????????????????????£?
????public class Common implements Runnable {
????public synchronized void method1() throws InterruptedException {
????Thread.sleep(1000);
????System.out.println("Method 1 called");
????Thread.sleep(1000);
????System.out.println("Method 1 done");
????}
????public synchronized void method2() throws InterruptedException {
????Thread.sleep(1000);
????System.err.println("Method 2 called");
????Thread.sleep(1000);
????System.err.println("Method 2 done");
????}
????public void run() {
????System.out.println("Running " + Thread.currentThread().getName());
????try {
????if (Thread.currentThread().getName().equals("Thread-1")) {
????method1();
????} else {
????method2();
????// Thread.currentThread().notify();
????}
????} catch (Exception e) {
????e.printStackTrace();
????}
????}
????public static void main(String[] args) throws InterruptedException {
????Common c = new Common();
????Thread t1 = new Thread(c?? "Thread-1");
????Thread t2 = new Thread(c?? "Thread-2");
????t1.start();
????t2.start();
????// ???′????????????????????????????????????????
????// Common c1 = new Common();
????// Common c2 = new Common();
????// c1.start();
????// c2.start();
????}
????}
??????н?????£?
????Running Thread-1
????Running Thread-2
????Method 1 called
????Method 1 done
????Method 2 called
????Method 2 done
???????????????????????漰???????????????????SPASVOС??(021-61079698-8054)?????????????????????????
??????
Java???????????Щ???????????????Java????????????????Java?б???Map????????Java Web???????????????Java??????????????д?????Java????????7???????????????????????(java .net ?????)???Java??????????Python??????Java webdriver??λ????????′????е?????Java??д??????????????????Java???????????????JavaScript????????????Java?????????????????? Java???????10??????????????Java?м????????????????java???????ü???????????м???????????????????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11????????
?????????App Bug???????????????????????Jmeter?????????QC??????APP????????????????app?????е????????jenkins+testng+ant+webdriver??????????????JMeter????HTTP???????Selenium 2.0 WebDriver ??????