Skip to content

Commit 72d0471

Browse files
committed
Introduce Intellij process visable scheduler to Rxjava
Signed-off-by: Wei Zhang <[email protected]>
1 parent f729fc8 commit 72d0471

File tree

3 files changed

+70
-1
lines changed

3 files changed

+70
-1
lines changed

PluginsAndFeatures/azure-toolkit-for-intellij/src/com/microsoft/azure/hdinsight/spark/run/SparkBatchJobRemoteProcess.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
import com.microsoft.azure.hdinsight.sdk.cluster.IClusterDetail;
3131
import com.microsoft.azure.hdinsight.spark.common.*;
3232
import com.microsoft.azure.hdinsight.spark.jobs.JobUtils;
33+
import com.microsoft.intellij.rxjava.IdeaSchedulers;
3334
import org.apache.commons.io.output.NullOutputStream;
3435
import org.jetbrains.annotations.NotNull;
3536
import org.jetbrains.annotations.Nullable;
@@ -163,7 +164,8 @@ public void start() {
163164
.orElseThrow(() -> propagate(new SparkJobException("Can't find jar path to upload"))),
164165
submitModel.getSubmissionParameter().getClusterName(),
165166
ctrlSubject)
166-
.subscribeOn(Schedulers.io());
167+
.subscribeOn(IdeaSchedulers.processBarVisable());
168+
// .subscribeOn(Schedulers.io());
167169
})
168170
.flatMap(clusterArtifactUriPair -> {
169171
logInfo("The Spark job is submitting ...");
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
/*
2+
* Copyright (c) Microsoft Corporation
3+
*
4+
* All rights reserved.
5+
*
6+
* MIT License
7+
*
8+
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
9+
* documentation files (the "Software"), to deal in the Software without restriction, including without limitation
10+
* the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
11+
* to permit persons to whom the Software is furnished to do so, subject to the following conditions:
12+
*
13+
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of
14+
* the Software.
15+
*
16+
* THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
17+
* THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
19+
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20+
* SOFTWARE.
21+
*/
22+
23+
package com.microsoft.intellij.rxjava;
24+
25+
import com.intellij.openapi.application.ApplicationManager;
26+
import org.jetbrains.annotations.NotNull;
27+
28+
import java.util.concurrent.Executor;
29+
30+
public class ApplicationManagerInvokeAndWaitExecutor implements Executor {
31+
@Override
32+
public void execute(@NotNull Runnable command) {
33+
ApplicationManager.getApplication().invokeAndWait(command);
34+
}
35+
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
/*
2+
* Copyright (c) Microsoft Corporation
3+
*
4+
* All rights reserved.
5+
*
6+
* MIT License
7+
*
8+
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
9+
* documentation files (the "Software"), to deal in the Software without restriction, including without limitation
10+
* the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
11+
* to permit persons to whom the Software is furnished to do so, subject to the following conditions:
12+
*
13+
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of
14+
* the Software.
15+
*
16+
* THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
17+
* THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
19+
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20+
* SOFTWARE.
21+
*/
22+
23+
package com.microsoft.intellij.rxjava;
24+
25+
import rx.Scheduler;
26+
import rx.schedulers.Schedulers;
27+
28+
public class IdeaSchedulers {
29+
public static Scheduler processBarVisable() {
30+
return Schedulers.from(new ApplicationManagerInvokeAndWaitExecutor());
31+
}
32+
}

0 commit comments

Comments
 (0)