@@ -93,7 +93,7 @@ public void runJob(DataFrameAnalyticsTask task, DataFrameAnalyticsConfig config,
9393 Consumer <Exception > finishHandler ) {
9494 executorServiceForJob .execute (() -> {
9595 ProcessContext processContext = new ProcessContext (config .getId ());
96- synchronized (this ) {
96+ synchronized (processContextByAllocation ) {
9797 if (task .isStopping ()) {
9898 // The task was requested to stop before we created the process context
9999 finishHandler .accept (null );
@@ -295,14 +295,17 @@ private void closeProcess(DataFrameAnalyticsTask task) {
295295 processContext .process .close ();
296296 LOGGER .info ("[{}] Closed process" , configId );
297297 } catch (Exception e ) {
298- String errorMsg = new ParameterizedMessage ("[{}] Error closing data frame analyzer process [{}]"
299- , configId , e .getMessage ()).getFormattedMessage ();
298+ String errorMsg = new ParameterizedMessage (
299+ "[{}] Error closing data frame analyzer process [{}]" , configId , e .getMessage ()).getFormattedMessage ();
300300 processContext .setFailureReason (errorMsg );
301301 }
302302 }
303303
304- public synchronized void stop (DataFrameAnalyticsTask task ) {
305- ProcessContext processContext = processContextByAllocation .get (task .getAllocationId ());
304+ public void stop (DataFrameAnalyticsTask task ) {
305+ ProcessContext processContext ;
306+ synchronized (processContextByAllocation ) {
307+ processContext = processContextByAllocation .get (task .getAllocationId ());
308+ }
306309 if (processContext != null ) {
307310 LOGGER .debug ("[{}] Stopping process" , task .getParams ().getId ());
308311 processContext .stop ();
0 commit comments