use of com.birbit.android.jobqueue.messaging.SafeMessageQueue in project android-priority-jobqueue by yigit.
the class ConsumerManager method addWorker.
private void addWorker() {
JqLog.d("adding another consumer");
Consumer consumer = new Consumer(jobManagerThread.messageQueue, new SafeMessageQueue(timer, factory, "consumer"), factory, timer);
final Thread thread;
if (threadFactory != null) {
thread = threadFactory.newThread(consumer);
} else {
thread = new Thread(threadGroup, consumer, "job-queue-worker-" + UUID.randomUUID());
thread.setPriority(threadPriority);
}
consumers.add(consumer);
try {
thread.start();
} catch (InternalError error) {
// process is already dying, no reason to crash for this (and hide the real crash)
JqLog.e(error, "Cannot start a thread. Looks like app is shutting down." + "See issue #294 for details.");
}
}
Aggregations