|
54 | 54 | import org.elasticsearch.common.settings.Settings.Builder;
|
55 | 55 | import org.elasticsearch.common.transport.TransportAddress;
|
56 | 56 | import org.elasticsearch.common.unit.TimeValue;
|
57 |
| -import org.elasticsearch.common.util.concurrent.RunOnce; |
58 | 57 | import org.elasticsearch.discovery.zen.PublishClusterStateStats;
|
59 | 58 | import org.elasticsearch.discovery.zen.UnicastHostsProvider.HostsResolver;
|
60 | 59 | import org.elasticsearch.indices.cluster.FakeThreadPoolMasterService;
|
|
78 | 77 | import java.util.Optional;
|
79 | 78 | import java.util.Set;
|
80 | 79 | import java.util.concurrent.Callable;
|
81 |
| -import java.util.concurrent.TimeUnit; |
82 | 80 | import java.util.concurrent.atomic.AtomicBoolean;
|
83 | 81 | import java.util.function.Consumer;
|
84 | 82 | import java.util.function.Function;
|
@@ -1146,13 +1144,18 @@ void runRandomly() {
|
1146 | 1144 | logger.debug("----> [runRandomly {}] rebooting [{}]", thisStep, clusterNode.getId());
|
1147 | 1145 | clusterNode.close();
|
1148 | 1146 | clusterNodes.forEach(
|
1149 |
| - cn -> { |
1150 |
| - final Runnable disconnectAction = new RunOnce(() -> cn.onNode( |
1151 |
| - () -> cn.transportService.disconnectFromNode(clusterNode.getLocalNode())).run()); |
1152 |
| - cleanupActions.add(disconnectAction); |
1153 |
| - final int delay = scaledRandomIntBetween(0, Math.toIntExact(TimeUnit.MINUTES.toMillis(rarely() ? 15 : 1))); |
1154 |
| - deterministicTaskQueue.scheduleAt(deterministicTaskQueue.getCurrentTimeMillis() + delay, disconnectAction); |
1155 |
| - }); |
| 1147 | + cn -> deterministicTaskQueue.scheduleNow(cn.onNode( |
| 1148 | + new Runnable() { |
| 1149 | + @Override |
| 1150 | + public void run() { |
| 1151 | + cn.transportService.disconnectFromNode(clusterNode.getLocalNode()); |
| 1152 | + } |
| 1153 | + |
| 1154 | + @Override |
| 1155 | + public String toString() { |
| 1156 | + return "disconnect from " + clusterNode.getLocalNode() + " after shutdown"; |
| 1157 | + } |
| 1158 | + }))); |
1156 | 1159 | clusterNodes.replaceAll(cn -> cn == clusterNode ? cn.restartedNode() : cn);
|
1157 | 1160 | } else if (rarely()) {
|
1158 | 1161 | final ClusterNode clusterNode = getAnyNode();
|
|
0 commit comments