1 8 9 package foxtrot; 10 11 15 abstract class AbstractWorker 16 { 17 static final boolean debug = false; 18 19 private WorkerThread workerThread; 20 21 AbstractWorker() 22 { 23 } 24 25 32 WorkerThread workerThread() 33 { 34 if (workerThread == null) workerThread(createDefaultWorkerThread()); 35 return workerThread; 36 } 37 38 46 void workerThread(WorkerThread workerThread) 47 { 48 if (workerThread == null) throw new IllegalArgumentException ("WorkerThread cannot be null"); 49 this.workerThread = workerThread; 50 if (debug) System.out.println("[AbstractWorker] Initialized WorkerThread: " + workerThread); 51 } 52 53 56 abstract WorkerThread createDefaultWorkerThread(); 57 } 58 | Popular Tags |