Skip to content

Commit

Permalink
Add batch job service to the DEPLOYMENT_COMPLETE_SERVICES list
Browse files Browse the repository at this point in the history
This ensures that the deployment will be considered complete once Batch
jobs services have been properly installed.
  • Loading branch information
jmesnil committed Nov 13, 2018
1 parent d07c57c commit 1e7b236
Showing 1 changed file with 5 additions and 1 deletion.
Expand Up @@ -22,6 +22,8 @@

package org.wildfly.extension.batch.jberet.deployment;

import static org.jboss.as.server.deployment.Attachments.DEPLOYMENT_COMPLETE_SERVICES;

import javax.enterprise.inject.spi.BeanManager;

import org.jberet.repository.JobRepository;
Expand Down Expand Up @@ -158,7 +160,8 @@ public void deploy(final DeploymentPhaseContext phaseContext) throws DeploymentU
serviceBuilder.install();

// Install the JobOperatorService
Services.addServerExecutorDependency(serviceTarget.addService(BatchServiceNames.jobOperatorServiceName(deploymentUnit), jobOperatorService)
ServiceName jobOperatorServiceName = BatchServiceNames.jobOperatorServiceName(deploymentUnit);
Services.addServerExecutorDependency(serviceTarget.addService(jobOperatorServiceName, jobOperatorService)
.addDependency(support.getCapabilityServiceName(Capabilities.BATCH_CONFIGURATION_CAPABILITY.getName()), BatchConfiguration.class, jobOperatorService.getBatchConfigurationInjector())
.addDependency(SuspendController.SERVICE_NAME, SuspendController.class, jobOperatorService.getSuspendControllerInjector())
.addDependency(BatchServiceNames.batchEnvironmentServiceName(deploymentUnit), SecurityAwareBatchEnvironment.class, jobOperatorService.getBatchEnvironmentInjector()),
Expand All @@ -167,6 +170,7 @@ public void deploy(final DeploymentPhaseContext phaseContext) throws DeploymentU

// Add the JobOperatorService to the deployment unit
deploymentUnit.putAttachment(BatchAttachments.JOB_OPERATOR, jobOperatorService);
deploymentUnit.addToAttachmentList(DEPLOYMENT_COMPLETE_SERVICES, jobOperatorServiceName);

// Add the JobOperator to the context selector
selector.registerContext(moduleClassLoader, JobOperatorContext.create(jobOperatorService));
Expand Down

0 comments on commit 1e7b236

Please sign in to comment.