Runs jobs in the job queue
()
| 102 | * Runs jobs in the job queue |
| 103 | */ |
| 104 | @Override |
| 105 | public void run() { |
| 106 | while (!mDie) { |
| 107 | synchronized (mJobSync) { |
| 108 | if (hasJob()) { |
| 109 | final Runnable job = mJob; |
| 110 | try { |
| 111 | job.run(); |
| 112 | } catch (final Throwable t) { |
| 113 | Diagnostic.error(ErrorType.SLIM_ERROR); |
| 114 | Diagnostic.userLog(t); |
| 115 | } |
| 116 | synchronized (mCompleteNotify) { |
| 117 | setJob(null); |
| 118 | mCompleteNotify.notifyAll(); |
| 119 | } |
| 120 | } |
| 121 | } |
| 122 | synchronized (mSleepSync) { |
| 123 | try { |
| 124 | if (!hasJob() && !mDie) { |
| 125 | mSleepSync.wait(SLEEP_TIME); |
| 126 | } |
| 127 | } catch (final InterruptedException e) { |
| 128 | //no problem |
| 129 | } |
| 130 | } |
| 131 | } |
| 132 | } |
| 133 | } |