use of javax.batch.runtime.JobInstance in project wildfly by wildfly.
the class JobOperatorService method restart.
@Override
public long restart(final long executionId, final Properties restartParameters) throws JobExecutionAlreadyCompleteException, NoSuchJobExecutionException, JobExecutionNotMostRecentException, JobRestartException, JobSecurityException {
checkState(null, "restart");
final ClassLoader current = WildFlySecurityManager.getCurrentContextClassLoaderPrivileged();
try {
WildFlySecurityManager.setCurrentContextClassLoaderPrivileged(classLoader);
final JobInstance instance = super.getJobInstance(executionId);
validateJob(instance.getJobName());
return super.restart(executionId, restartParameters, getBatchEnvironment().getCurrentUserName());
} finally {
WildFlySecurityManager.setCurrentContextClassLoaderPrivileged(current);
}
}
use of javax.batch.runtime.JobInstance in project wildfly by wildfly.
the class JobOperatorService method getJobExecution.
@Override
public JobExecution getJobExecution(final long executionId) throws NoSuchJobExecutionException, JobSecurityException {
checkState();
final ClassLoader current = WildFlySecurityManager.getCurrentContextClassLoaderPrivileged();
try {
WildFlySecurityManager.setCurrentContextClassLoaderPrivileged(classLoader);
final JobInstance instance = getJobInstance(executionId);
validateJob(instance.getJobName());
return super.getJobExecution(executionId);
} finally {
WildFlySecurityManager.setCurrentContextClassLoaderPrivileged(current);
}
}
use of javax.batch.runtime.JobInstance in project wildfly by wildfly.
the class JobOperatorService method getStepExecutions.
@Override
public List<StepExecution> getStepExecutions(final long jobExecutionId) throws NoSuchJobExecutionException, JobSecurityException {
checkState();
final ClassLoader current = WildFlySecurityManager.getCurrentContextClassLoaderPrivileged();
try {
WildFlySecurityManager.setCurrentContextClassLoaderPrivileged(classLoader);
final JobInstance instance = super.getJobInstance(jobExecutionId);
validateJob(instance.getJobName());
return super.getStepExecutions(jobExecutionId);
} finally {
WildFlySecurityManager.setCurrentContextClassLoaderPrivileged(current);
}
}
use of javax.batch.runtime.JobInstance in project wildfly by wildfly.
the class JobOperatorService method abandon.
@Override
public void abandon(final long executionId) throws NoSuchJobExecutionException, JobExecutionIsRunningException, JobSecurityException {
checkState(null, "abandon");
final ClassLoader current = WildFlySecurityManager.getCurrentContextClassLoaderPrivileged();
try {
WildFlySecurityManager.setCurrentContextClassLoaderPrivileged(classLoader);
final JobInstance instance = super.getJobInstance(executionId);
validateJob(instance.getJobName());
super.abandon(executionId);
} finally {
WildFlySecurityManager.setCurrentContextClassLoaderPrivileged(current);
}
}
use of javax.batch.runtime.JobInstance in project wildfly by wildfly.
the class BatchJobExecutionResource method refreshChildren.
/**
* Note the access to the {@link #children} is <strong>not</strong> guarded here and needs to be externally
* guarded.
*/
private void refreshChildren() {
final List<JobExecution> executions = new ArrayList<>();
// Casting to (Supplier<List<JobInstance>>) is done here on purpose as a workaround for a bug in 1.8.0_45
final List<JobInstance> instances = jobOperator.allowMissingJob((Supplier<List<JobInstance>>) () -> jobOperator.getJobInstances(jobName, 0, jobOperator.getJobInstanceCount(jobName)), Collections.emptyList());
for (JobInstance instance : instances) {
executions.addAll(jobOperator.getJobExecutions(instance));
}
for (JobExecution execution : executions) {
final String name = Long.toString(execution.getExecutionId());
if (!children.contains(name)) {
children.add(name);
}
}
}
Aggregations