Concurrency: Basic Threading (3)
9. Coding variations 9.1. 直接继承Thread 创建任务除了通过实现Runnable接口,也可以通过直接继承Thread的方式来实现。 public class SimpleThread extends Thread { private int countDown = 5; private static int threadCount = 0; public Simp…
Read more
learn, build, evaluate
9. Coding variations 9.1. 直接继承Thread 创建任务除了通过实现Runnable接口,也可以通过直接继承Thread的方式来实现。 public class SimpleThread extends Thread { private int countDown = 5; private static int threadCount = 0; public Simp…
Read more
5. Sleep Sleep()可以在指定时间内阻塞当前任务的执行。 import java.util.concurrent.*; public class SleepingTask extends LiftOff { public void run() { try { while(countDown– > 0) { System.out.print(status()); // Old…
Read more