Skip to content

Commit

Permalink
Merge pull request #1842 from microsoft/hotfix-maven-task-manager
Browse files Browse the repository at this point in the history
maven has no AzureTaskManager which cause spring cloud stuck on deplo…
  • Loading branch information
wangmingliang-ms authored Nov 26, 2021
2 parents a6d46db + fcf60c5 commit 4d8c96f
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,14 @@
import com.microsoft.azure.toolkit.lib.common.model.Subscription;
import com.microsoft.azure.toolkit.lib.common.proxy.ProxyInfo;
import com.microsoft.azure.toolkit.lib.common.proxy.ProxyManager;
import com.microsoft.azure.toolkit.lib.common.task.AzureTaskManager;
import com.microsoft.azure.toolkit.lib.common.telemetry.AzureTelemeter;
import com.microsoft.azure.toolkit.lib.common.telemetry.AzureTelemetry;
import com.microsoft.azure.toolkit.lib.common.telemetry.AzureTelemetryClient;
import com.microsoft.azure.toolkit.lib.common.utils.InstallationIdUtils;
import com.microsoft.azure.toolkit.lib.common.utils.TextUtils;
import com.microsoft.azure.toolkit.maven.common.messager.MavenAzureMessager;
import com.microsoft.azure.toolkit.maven.common.task.MavenAzureTaskManager;
import lombok.Getter;
import lombok.SneakyThrows;
import org.apache.commons.collections4.CollectionUtils;
Expand Down Expand Up @@ -460,6 +462,7 @@ public String getActualAuthType() {
@Override
public void execute() throws MojoExecutionException {
try {
AzureTaskManager.register(new MavenAzureTaskManager());
AzureMessager.setDefaultMessager(new MavenAzureMessager());
Azure.az().config().setLogLevel(HttpLogDetailLevel.NONE.name());
Azure.az().config().setUserAgent(getUserAgent());
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*/

package com.microsoft.azure.toolkit.maven.common.task;

import com.microsoft.azure.toolkit.lib.common.task.AzureTask;
import com.microsoft.azure.toolkit.lib.common.task.AzureTaskManager;
import reactor.core.publisher.Mono;
import reactor.core.scheduler.Schedulers;

public class MavenAzureTaskManager extends AzureTaskManager {
@Override
protected void doRead(Runnable runnable, AzureTask<?> task) {
throw new UnsupportedOperationException("not support");
}

@Override
protected void doWrite(Runnable runnable, AzureTask<?> task) {
throw new UnsupportedOperationException("not support");
}

@Override
protected void doRunLater(Runnable runnable, AzureTask<?> task) {
throw new UnsupportedOperationException("not support");
}

@Override
protected void doRunOnPooledThread(Runnable runnable, AzureTask<?> task) {
Mono.fromRunnable(runnable).subscribeOn(Schedulers.boundedElastic()).subscribe();
}

@Override
protected void doRunAndWait(Runnable runnable, AzureTask<?> task) {
runnable.run();
}

@Override
protected void doRunInBackground(Runnable runnable, AzureTask<?> task) {
doRunOnPooledThread(runnable, task);
}

@Override
protected void doRunInModal(Runnable runnable, AzureTask<?> task) {
throw new UnsupportedOperationException("not support");
}
}

0 comments on commit 4d8c96f

Please sign in to comment.