diff --git a/plugin/src/main/java/org/opensearch/ml/action/tasks/CancelBatchJobTransportAction.java b/plugin/src/main/java/org/opensearch/ml/action/tasks/CancelBatchJobTransportAction.java index 7a178c4706..b9bbff7db6 100644 --- a/plugin/src/main/java/org/opensearch/ml/action/tasks/CancelBatchJobTransportAction.java +++ b/plugin/src/main/java/org/opensearch/ml/action/tasks/CancelBatchJobTransportAction.java @@ -197,15 +197,17 @@ private void processRemoteBatchPrediction(MLTask mlTask, ActionListener listener = ActionListener - .wrap(connector -> { - executeConnector(connector, mlInput, actionListener); - }, e -> { + .wrap(connector -> { executeConnector(connector, mlInput, actionListener); }, e -> { log.error("Failed to get connector " + model.getConnectorId(), e); actionListener.onFailure(e); }); try (ThreadContext.StoredContext threadContext = client.threadPool().getThreadContext().stashContext()) { connectorAccessControlHelper - .getConnector(client, model.getConnectorId(), ActionListener.runBefore(listener, threadContext::restore)); + .getConnector( + client, + model.getConnectorId(), + ActionListener.runBefore(listener, threadContext::restore) + ); } } else { actionListener.onFailure(new ResourceNotFoundException("Can't find connector " + model.getConnectorId())); @@ -236,8 +238,7 @@ private void executeConnector(Connector connector, MLInput mlInput, ActionListen connector.addAction(connectorAction); } connector.decrypt(CANCEL_BATCH_PREDICT.name(), (credential) -> encryptor.decrypt(credential)); - RemoteConnectorExecutor connectorExecutor = MLEngineClassLoader - .initInstance(connector.getProtocol(), connector, Connector.class); + RemoteConnectorExecutor connectorExecutor = MLEngineClassLoader.initInstance(connector.getProtocol(), connector, Connector.class); connectorExecutor.setScriptService(scriptService); connectorExecutor.setClusterService(clusterService); connectorExecutor.setClient(client); diff --git a/plugin/src/main/java/org/opensearch/ml/action/tasks/GetTaskTransportAction.java b/plugin/src/main/java/org/opensearch/ml/action/tasks/GetTaskTransportAction.java index f5711028f5..fc6b3429a4 100644 --- a/plugin/src/main/java/org/opensearch/ml/action/tasks/GetTaskTransportAction.java +++ b/plugin/src/main/java/org/opensearch/ml/action/tasks/GetTaskTransportAction.java @@ -265,7 +265,11 @@ private void processRemoteBatchPrediction(MLTask mlTask, String taskId, ActionLi }); try (ThreadContext.StoredContext threadContext = client.threadPool().getThreadContext().stashContext()) { connectorAccessControlHelper - .getConnector(client, model.getConnectorId(), ActionListener.runBefore(listener, threadContext::restore)); + .getConnector( + client, + model.getConnectorId(), + ActionListener.runBefore(listener, threadContext::restore) + ); } } else { actionListener.onFailure(new ResourceNotFoundException("Can't find connector " + model.getConnectorId())); @@ -303,8 +307,7 @@ private void executeConnector( connector.addAction(connectorAction); } connector.decrypt(BATCH_PREDICT_STATUS.name(), (credential) -> encryptor.decrypt(credential)); - RemoteConnectorExecutor connectorExecutor = MLEngineClassLoader - .initInstance(connector.getProtocol(), connector, Connector.class); + RemoteConnectorExecutor connectorExecutor = MLEngineClassLoader.initInstance(connector.getProtocol(), connector, Connector.class); connectorExecutor.setScriptService(scriptService); connectorExecutor.setClusterService(clusterService); connectorExecutor.setClient(client); diff --git a/plugin/src/test/java/org/opensearch/ml/action/tasks/GetTaskTransportActionTests.java b/plugin/src/test/java/org/opensearch/ml/action/tasks/GetTaskTransportActionTests.java index 848f9fb04f..8f655fe59e 100644 --- a/plugin/src/test/java/org/opensearch/ml/action/tasks/GetTaskTransportActionTests.java +++ b/plugin/src/test/java/org/opensearch/ml/action/tasks/GetTaskTransportActionTests.java @@ -35,7 +35,6 @@ import org.mockito.ArgumentCaptor; import org.mockito.Mock; import org.mockito.MockitoAnnotations; -import org.opensearch.OpenSearchStatusException; import org.opensearch.ResourceNotFoundException; import org.opensearch.action.get.GetResponse; import org.opensearch.action.support.ActionFilters;