Search in sources :

Example 1 with JdbcRepository

use of org.jberet.repository.JdbcRepository in project wildfly by wildfly.

the class JdbcJobRepositoryService method startJobRepository.

@Override
public void startJobRepository(final StartContext context) throws StartException {
    final ExecutorService service = executor.getValue();
    final Runnable task = () -> {
        try {
            // Currently in jBeret tables are created in the constructor which is why this is done asynchronously
            jobRepository = new JdbcRepository(dataSourceValue.getValue());
            context.complete();
        } catch (Exception e) {
            context.failed(BatchLogger.LOGGER.failedToCreateJobRepository(e, "JDBC"));
        }
    };
    try {
        service.execute(task);
    } catch (RejectedExecutionException e) {
        task.run();
    } finally {
        context.asynchronous();
    }
}
Also used : JdbcRepository(org.jberet.repository.JdbcRepository) ExecutorService(java.util.concurrent.ExecutorService) RejectedExecutionException(java.util.concurrent.RejectedExecutionException) StartException(org.jboss.msc.service.StartException) RejectedExecutionException(java.util.concurrent.RejectedExecutionException)

Aggregations

ExecutorService (java.util.concurrent.ExecutorService)1 RejectedExecutionException (java.util.concurrent.RejectedExecutionException)1 JdbcRepository (org.jberet.repository.JdbcRepository)1 StartException (org.jboss.msc.service.StartException)1