Internal: Readd accidental removed functionality in InternalClusterService
The commit about adding cluster health response features also removed
accidentally some functionality, that resulted in wrong instanceof checks
in InternalClusterService and thus in test failures because the cluster
state task that was added via an anonymous was missing the cast.
This commit readds the abstract class with slight renaming.
Commit id was: 88f8d58c8b
This commit is contained in:
parent
1f3670733a
commit
eb23530e06
|
@ -243,7 +243,7 @@ public class InternalClusterService extends AbstractLifecycleComponent<ClusterSe
|
||||||
}
|
}
|
||||||
// call the post added notification on the same event thread
|
// call the post added notification on the same event thread
|
||||||
try {
|
try {
|
||||||
updateTasksExecutor.execute(new PrioritizedRunnable(Priority.HIGH) {
|
updateTasksExecutor.execute(new SourcePrioritizedRunnable(Priority.HIGH, "_add_listener_") {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
if (timeout != null) {
|
if (timeout != null) {
|
||||||
|
@ -312,12 +312,12 @@ public class InternalClusterService extends AbstractLifecycleComponent<ClusterSe
|
||||||
final Object task = pending.task;
|
final Object task = pending.task;
|
||||||
if (task == null) {
|
if (task == null) {
|
||||||
continue;
|
continue;
|
||||||
} else if (task instanceof UpdateTask) {
|
} else if (task instanceof SourcePrioritizedRunnable) {
|
||||||
UpdateTask runnable = (UpdateTask) task;
|
SourcePrioritizedRunnable runnable = (SourcePrioritizedRunnable) task;
|
||||||
source = runnable.source();
|
source = runnable.source();
|
||||||
timeInQueue = runnable.getAgeInMillis();
|
timeInQueue = runnable.getAgeInMillis();
|
||||||
} else {
|
} else {
|
||||||
assert false : "expected TimedPrioritizedRunnable got " + task.getClass();
|
assert false : "expected SourcePrioritizedRunnable got " + task.getClass();
|
||||||
source = "unknown [" + task.getClass() + "]";
|
source = "unknown [" + task.getClass() + "]";
|
||||||
timeInQueue = 0;
|
timeInQueue = 0;
|
||||||
}
|
}
|
||||||
|
@ -337,21 +337,27 @@ public class InternalClusterService extends AbstractLifecycleComponent<ClusterSe
|
||||||
return updateTasksExecutor.getMaxTaskWaitTime();
|
return updateTasksExecutor.getMaxTaskWaitTime();
|
||||||
}
|
}
|
||||||
|
|
||||||
class UpdateTask extends PrioritizedRunnable {
|
static abstract class SourcePrioritizedRunnable extends PrioritizedRunnable {
|
||||||
|
|
||||||
public final ClusterStateUpdateTask updateTask;
|
|
||||||
protected final String source;
|
protected final String source;
|
||||||
|
|
||||||
|
public SourcePrioritizedRunnable(Priority priority, String source) {
|
||||||
UpdateTask(String source, Priority priority, ClusterStateUpdateTask updateTask) {
|
|
||||||
super(priority);
|
super(priority);
|
||||||
this.updateTask = updateTask;
|
|
||||||
this.source = source;
|
this.source = source;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String source() {
|
public String source() {
|
||||||
return source;
|
return source;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class UpdateTask extends SourcePrioritizedRunnable {
|
||||||
|
|
||||||
|
public final ClusterStateUpdateTask updateTask;
|
||||||
|
|
||||||
|
UpdateTask(String source, Priority priority, ClusterStateUpdateTask updateTask) {
|
||||||
|
super(priority, source);
|
||||||
|
this.updateTask = updateTask;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
|
Loading…
Reference in New Issue