diff --git a/server/src/main/java/org/elasticsearch/transport/RemoteClusterConnection.java b/server/src/main/java/org/elasticsearch/transport/RemoteClusterConnection.java index 6f52e51e879d6..9836aea15cbc7 100644 --- a/server/src/main/java/org/elasticsearch/transport/RemoteClusterConnection.java +++ b/server/src/main/java/org/elasticsearch/transport/RemoteClusterConnection.java @@ -374,7 +374,6 @@ private void connect(ActionListener connectListener, boolean forceRun) { private void forkConnect(final Collection> toNotify) { ThreadPool threadPool = transportService.getThreadPool(); - assert threadPool.getThreadContext().isSystemContext() == false : "context is a system context"; ExecutorService executor = threadPool.executor(ThreadPool.Names.MANAGEMENT); executor.submit(new AbstractRunnable() { @Override @@ -451,7 +450,6 @@ void collectRemoteNodes(Iterator seedNodes, // due to an already closed connection. ThreadPool threadPool = transportService.getThreadPool(); ThreadContext threadContext = threadPool.getThreadContext(); - assert threadContext.isSystemContext() == false : "context is a system context"; TransportService.ContextRestoreResponseHandler responseHandler = new TransportService .ContextRestoreResponseHandler<>(threadContext.newRestorableContext(false), new SniffClusterStateResponseHandler(transportService, connection, listener, seedNodes, @@ -530,7 +528,6 @@ public ClusterStateResponse newInstance() { @Override public void handleResponse(ClusterStateResponse response) { - assert transportService.getThreadPool().getThreadContext().isSystemContext() == false : "context is a system context"; try { if (remoteClusterName.get() == null) { assert response.getClusterName().value() != null; @@ -570,7 +567,6 @@ public void handleResponse(ClusterStateResponse response) { @Override public void handleException(TransportException exp) { - assert transportService.getThreadPool().getThreadContext().isSystemContext() == false : "context is a system context"; logger.warn(() -> new ParameterizedMessage("fetching nodes from external cluster {} failed", clusterAlias), exp); try { IOUtils.closeWhileHandlingException(connection);