WorkQueue: rename prefix to queueName
Change-Id: Idf810517e7d247f51134b98fc6db6b6c9bf153c7 Signed-off-by: Eryk Szymanski <eryksz@gmail.com>
This commit is contained in:
@@ -104,8 +104,8 @@ public class WorkQueue {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** Create a new executor queue. */
|
/** Create a new executor queue. */
|
||||||
public Executor createQueue(int poolsize, String prefix) {
|
public Executor createQueue(int poolsize, String queueName) {
|
||||||
final Executor r = new Executor(poolsize, prefix);
|
final Executor r = new Executor(poolsize, queueName);
|
||||||
r.setContinueExistingPeriodicTasksAfterShutdownPolicy(false);
|
r.setContinueExistingPeriodicTasksAfterShutdownPolicy(false);
|
||||||
r.setExecuteExistingDelayedTasksAfterShutdownPolicy(true);
|
r.setExecuteExistingDelayedTasksAfterShutdownPolicy(true);
|
||||||
queues.add(r);
|
queues.add(r);
|
||||||
@@ -176,7 +176,7 @@ public class WorkQueue {
|
|||||||
private final ConcurrentHashMap<Integer, Task<?>> all;
|
private final ConcurrentHashMap<Integer, Task<?>> all;
|
||||||
private final String queueName;
|
private final String queueName;
|
||||||
|
|
||||||
Executor(int corePoolSize, final String prefix) {
|
Executor(int corePoolSize, final String queueName) {
|
||||||
super(
|
super(
|
||||||
corePoolSize,
|
corePoolSize,
|
||||||
new ThreadFactory() {
|
new ThreadFactory() {
|
||||||
@@ -186,7 +186,7 @@ public class WorkQueue {
|
|||||||
@Override
|
@Override
|
||||||
public Thread newThread(final Runnable task) {
|
public Thread newThread(final Runnable task) {
|
||||||
final Thread t = parent.newThread(task);
|
final Thread t = parent.newThread(task);
|
||||||
t.setName(prefix + "-" + tid.getAndIncrement());
|
t.setName(queueName + "-" + tid.getAndIncrement());
|
||||||
t.setUncaughtExceptionHandler(LOG_UNCAUGHT_EXCEPTION);
|
t.setUncaughtExceptionHandler(LOG_UNCAUGHT_EXCEPTION);
|
||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
@@ -198,7 +198,7 @@ public class WorkQueue {
|
|||||||
0.75f, // load factor
|
0.75f, // load factor
|
||||||
corePoolSize + 4 // concurrency level
|
corePoolSize + 4 // concurrency level
|
||||||
);
|
);
|
||||||
queueName = prefix;
|
this.queueName = queueName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void unregisterWorkQueue() {
|
public void unregisterWorkQueue() {
|
||||||
|
Reference in New Issue
Block a user