1 8 9 package foxtrot; 10 11 import foxtrot.workers.SingleWorkerThread; 12 13 47 public class Worker extends AbstractSyncWorker 48 { 49 private static Worker instance = new Worker(); 50 51 54 private Worker() 55 { 56 } 57 58 65 public static WorkerThread getWorkerThread() 66 { 67 return instance.workerThread(); 68 } 69 70 76 public static void setWorkerThread(WorkerThread workerThread) 77 { 78 instance.workerThread(workerThread); 79 } 80 81 WorkerThread createDefaultWorkerThread() 82 { 83 return new SingleWorkerThread(); 84 } 85 86 93 public static EventPump getEventPump() 94 { 95 return instance.eventPump(); 96 } 97 98 107 public static void setEventPump(EventPump eventPump) 108 { 109 instance.eventPump(eventPump); 110 } 111 112 126 public static Object post(Task task) throws Exception 127 { 128 return instance.post(task, getWorkerThread(), getEventPump()); 129 } 130 131 137 public static Object post(Job job) 138 { 139 return instance.post(job, getWorkerThread(), getEventPump()); 140 } 141 } 142 | Popular Tags |