Class CloseDbConnectionsTasklet

  • All Implemented Interfaces:
    org.springframework.batch.core.step.tasklet.Tasklet, org.springframework.beans.factory.InitializingBean, ReportGenerator

    public class CloseDbConnectionsTasklet
    extends ReportTasklet
    implements ReportGenerator, org.springframework.beans.factory.InitializingBean
    Closes all idle connections in the StagingDB connection pool. Used in situations where you must ensure that all DB sessions are closed. For instance, if you must drop the Staging DB schema.
    • Constructor Detail

      • CloseDbConnectionsTasklet

        public CloseDbConnectionsTasklet()
    • Method Detail

      • afterPropertiesSet

        public void afterPropertiesSet()
                                throws java.lang.Exception
        Specified by:
        afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean
        Throws:
        java.lang.Exception
      • generateReport

        @Transactional(readOnly=true,
                       transactionManager="stagingTransactionManager")
        public ReportGenerationResult generateReport​(java.io.File reportFile,
                                                     org.springframework.batch.core.StepContribution sc,
                                                     org.springframework.batch.core.scope.context.ChunkContext cc)
                                              throws java.lang.Exception
        Description copied from interface: ReportGenerator
        Generate a report
        Specified by:
        generateReport in interface ReportGenerator
        Parameters:
        reportFile - The file to write the report to
        sc - The current step contribution
        cc - The current ChunkContext
        Returns:
        A ReportGenerationResult. Typically with the status OK. For certain types of report generators with a notion of "failure", it may make sense to return Failed, to support. See @SqlValidationTasklet
        Throws:
        java.lang.Exception