Skip to content

Commit 45ecd80

Browse files
authored
Merge pull request wildfly#19371 from HliasMpGH/WFLY-20562
[WFLY-20562] WildFly can eat exceptions
2 parents 368cb50 + c194bde commit 45ecd80

File tree

3 files changed

+23
-1
lines changed

3 files changed

+23
-1
lines changed

batch-jberet/src/main/java/org/wildfly/extension/batch/jberet/_private/BatchLogger.java

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,4 +203,24 @@ public interface BatchLogger extends BasicLogger {
203203

204204
@Message(id = 21, value = "Duplicate virtual file %s.")
205205
IllegalStateException duplicateVirtualFile(VirtualFile file);
206+
207+
/**
208+
* Creates an exception indicating the {@link org.wildfly.extension.batch.jberet.job.repository.JobRepositoryService
209+
* JobRepositoryService} has stopped.
210+
*
211+
* @return an {@link java.lang.IllegalStateException} for the error
212+
*/
213+
@Message(id = 22, value = "The service JobRepositoryService has been stopped and cannot execute operations.")
214+
IllegalStateException jobRepositoryServiceStopped();
215+
216+
/**
217+
* Logs an error message indicating that there was a problem
218+
* while stopping the running jobs.
219+
*
220+
* @param cause the cause of the error
221+
* @param deploymentName the name of the deployment
222+
*/
223+
@LogMessage(level = Level.ERROR)
224+
@Message(id = 23, value = "Failed to stop running jobs on deployment %s.")
225+
void failedToStopJobs(@Cause Throwable cause, String deploymentName);
206226
}

batch-jberet/src/main/java/org/wildfly/extension/batch/jberet/deployment/JobOperatorService.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -488,6 +488,8 @@ private void stopRunningJobs(final boolean queueForRestart) {
488488
}
489489
}
490490
}
491+
} catch (IllegalStateException e) {
492+
BatchLogger.LOGGER.failedToStopJobs(e, deploymentName);
491493
} finally {
492494
WildFlySecurityManager.setCurrentContextClassLoaderPrivileged(current);
493495
// Reset the stopped state

batch-jberet/src/main/java/org/wildfly/extension/batch/jberet/job/repository/JobRepositoryService.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,6 @@ private JobRepository getAndCheckDelegate() {
227227
if (started && delegate != null) {
228228
return delegate;
229229
}
230-
throw BatchLogger.LOGGER.jobOperatorServiceStopped();
230+
throw BatchLogger.LOGGER.jobRepositoryServiceStopped();
231231
}
232232
}

0 commit comments

Comments
 (0)