Skip to content

Commit

Permalink
update async task executor bean to unique name
Browse files Browse the repository at this point in the history
  • Loading branch information
swaroopar committed Jan 2, 2024
1 parent 7703f86 commit f590dc7
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -561,7 +561,7 @@ private DeployServiceEntity flushDestroyServiceEntity(DeployResult destroyResult
* @param deployTask deployTask
* @param deployServiceEntity deployServiceEntity
*/
@Async("taskExecutor")
@Async("xpanseAsyncTaskExecutor")
public void asyncPurgeService(Deployment deployment, DeployTask deployTask,
DeployServiceEntity deployServiceEntity) {
purgeService(deployment, deployTask, deployServiceEntity);
Expand Down Expand Up @@ -788,7 +788,7 @@ private void maskSensitiveFields(DeployServiceEntity deployServiceEntity) {
* @param deployRequest deploy request.
* @return new deployed service entity.
*/
@Async("taskExecutor")
@Async("xpanseAsyncTaskExecutor")
public CompletableFuture<DeployServiceEntity> deployServiceById(UUID newId,
String userId,
DeployRequest deployRequest) {
Expand All @@ -808,7 +808,7 @@ public CompletableFuture<DeployServiceEntity> deployServiceById(UUID newId,
/**
* Destroy service by deployed service id.
*/
@Async("taskExecutor")
@Async("xpanseAsyncTaskExecutor")
public CompletableFuture<DeployServiceEntity> destroyServiceById(String id) {
MDC.put(TASK_ID, id);
DeployServiceEntity deployServiceEntity = getDeployServiceEntity(UUID.fromString(id));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public class TaskConfiguration {
*
* @return executor
*/
@Bean("taskExecutor")
@Bean("xpanseAsyncTaskExecutor")
public Executor taskExecutor() {
ServiceThreadPoolTaskExecutor executor = new ServiceThreadPoolTaskExecutor();
executor.setCorePoolSize(CPU_COUNT * 2);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
import org.eclipse.xpanse.modules.orchestrator.deployment.DeployValidationResult;
import org.eclipse.xpanse.modules.orchestrator.deployment.Deployment;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.stereotype.Component;

Expand Down Expand Up @@ -63,8 +64,10 @@ public class TerraformDeployment implements Deployment {
@Autowired
public TerraformDeployment(
DeployEnvironments deployEnvironments,
TerraformLocalConfig terraformLocalConfig, PluginManager pluginManager,
DeployService deployService, Executor taskExecutor) {
TerraformLocalConfig terraformLocalConfig,
PluginManager pluginManager,
DeployService deployService,
@Qualifier("xpanseAsyncTaskExecutor") Executor taskExecutor) {
this.deployEnvironments = deployEnvironments;
this.terraformLocalConfig = terraformLocalConfig;
this.pluginManager = pluginManager;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import java.util.concurrent.Executor;
import org.apache.commons.lang3.StringUtils;
import org.eclipse.xpanse.modules.deployment.DeployService;
import org.eclipse.xpanse.modules.deployment.async.TaskConfiguration;
import org.eclipse.xpanse.modules.deployment.deployers.terraform.config.TerraformLocalConfig;
import org.eclipse.xpanse.modules.deployment.utils.DeployEnvironments;
import org.eclipse.xpanse.modules.models.service.common.enums.Csp;
Expand Down Expand Up @@ -53,7 +54,7 @@

@ExtendWith({SpringExtension.class})
@ContextConfiguration(classes = {TerraformDeployment.class, DeployEnvironments.class,
PluginManager.class, TerraformLocalConfig.class, DeployService.class, Executor.class})
PluginManager.class, TerraformLocalConfig.class, DeployService.class, TaskConfiguration.class})
class TerraformDeploymentTest {

private final UUID id = UUID.randomUUID();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public String getOpenApi(ServiceTemplateEntity serviceTemplateEntity) {
*
* @param registerService Registered services.
*/
@Async("taskExecutor")
@Async("xpanseAsyncTaskExecutor")
public void generateServiceApi(ServiceTemplateEntity registerService) {
createServiceApi(registerService);
}
Expand All @@ -99,7 +99,7 @@ public void generateServiceApi(ServiceTemplateEntity registerService) {
*
* @param registerService Registered services.
*/
@Async("taskExecutor")
@Async("xpanseAsyncTaskExecutor")
public void updateServiceApi(ServiceTemplateEntity registerService) {
File file =
new File(this.openApiGeneratorJarManage.getOpenApiWorkdir(),
Expand All @@ -115,7 +115,7 @@ public void updateServiceApi(ServiceTemplateEntity registerService) {
*
* @param id ID of registered service.
*/
@Async("taskExecutor")
@Async("xpanseAsyncTaskExecutor")
public void deleteServiceApi(String id) {
File file = new File(this.openApiGeneratorJarManage.getOpenApiWorkdir(),
id + OPENAPI_FILE_EXTENSION);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public ProcessInstance startProcess(String processKey, Map<String, Object> varia
return runtimeService.startProcessInstanceByKey(processKey, variable);
}

@Async("taskExecutor")
@Async("xpanseAsyncTaskExecutor")
public void asyncStartProcess(String processKey, Map<String, Object> variable) {
startProcess(processKey, variable);
}
Expand Down

0 comments on commit f590dc7

Please sign in to comment.