mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-03-28 10:58:30 +00:00
Throw if the local node is not set
This commit adds an IllegalStateException if attempting to get the local node from the cluster service when it is not set. Relates #18963
This commit is contained in:
parent
92bc29266b
commit
6b46bf13f0
@ -237,7 +237,11 @@ public class ClusterService extends AbstractLifecycleComponent<ClusterService> {
|
||||
* The local node.
|
||||
*/
|
||||
public DiscoveryNode localNode() {
|
||||
return clusterState.getNodes().getLocalNode();
|
||||
DiscoveryNode localNode = clusterState.getNodes().getLocalNode();
|
||||
if (localNode == null) {
|
||||
throw new IllegalStateException("No local node found. Is the node started?");
|
||||
}
|
||||
return localNode;
|
||||
}
|
||||
|
||||
public OperationRouting operationRouting() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user