Hikari CP not shutting down when using second level caching via hibernate












0















I just upgraded my spring boot application (Spring Cloud Task) from 1.5 to 2.0.0 (Spring Boot) The jobs in the task/app are running perfectly fine but the jar doesn't close after the jobs are completed. It gets stuck here:



2018-11-14 18:08:21.711  INFO 7720 --- [           main] o.s.b.c.l.support.SimpleJobLauncher      : Job: [SimpleJob: [name=testJob]] completed with the following parameters: [{-spring.batch.job.names=testJob, run.id=10}] and the following status: [COMPLETED]
2018-11-14 18:08:21.719 DEBUG 7720 --- [ main] o.s.c.t.r.support.SimpleTaskRepository : Updating: TaskExecution with executionId=16 with the following {exitCode=0, endTime=Wed Nov 14 18:08:21 IST 2018, exitMessage='null', errorMessage='null'}


After I press ctrl+c on the keyboard the HikariCP shuts down:



^C2018-11-14 18:08:25.738  INFO 7720 --- [       Thread-4] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Shutdown initiated...
2018-11-14 18:08:25.740 INFO 7720 --- [ Thread-4] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Shutdown completed.


Whereas I want the app/jar to shut down as soon as the jobs are completed.



After some trial and error, I realized that when I remove the use of second level caching via hibernate in my application.yml it works fine, i.e. the hikariCP shuts down after jobs are completed.
This is my application.yaml:



spring:
application:
name: miq-batch
datasource:
url: jdbc:mysql://localhost:3306/scdf
username: root
password: root
driverClassName: org.mariadb.jdbc.Driver
data:
mongodb:
host: localhost
port: 27017
database: profile
jpa:
properties:
hibernate:
implicit_naming_strategy: org.hibernate.boot.model.naming.ImplicitNamingStrategyLegacyHbmImpl
hbm2ddl:
auto: update
cache:
use_second_level_cache: true
region.factory_class: org.hibernate.cache.ehcache.EhCacheRegionFactory
use_query_cache: true
use_collection_cache: true
jackson:
serialization:
FAIL_ON_EMPTY_BEANS: false









share|improve this question



























    0















    I just upgraded my spring boot application (Spring Cloud Task) from 1.5 to 2.0.0 (Spring Boot) The jobs in the task/app are running perfectly fine but the jar doesn't close after the jobs are completed. It gets stuck here:



    2018-11-14 18:08:21.711  INFO 7720 --- [           main] o.s.b.c.l.support.SimpleJobLauncher      : Job: [SimpleJob: [name=testJob]] completed with the following parameters: [{-spring.batch.job.names=testJob, run.id=10}] and the following status: [COMPLETED]
    2018-11-14 18:08:21.719 DEBUG 7720 --- [ main] o.s.c.t.r.support.SimpleTaskRepository : Updating: TaskExecution with executionId=16 with the following {exitCode=0, endTime=Wed Nov 14 18:08:21 IST 2018, exitMessage='null', errorMessage='null'}


    After I press ctrl+c on the keyboard the HikariCP shuts down:



    ^C2018-11-14 18:08:25.738  INFO 7720 --- [       Thread-4] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Shutdown initiated...
    2018-11-14 18:08:25.740 INFO 7720 --- [ Thread-4] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Shutdown completed.


    Whereas I want the app/jar to shut down as soon as the jobs are completed.



    After some trial and error, I realized that when I remove the use of second level caching via hibernate in my application.yml it works fine, i.e. the hikariCP shuts down after jobs are completed.
    This is my application.yaml:



    spring:
    application:
    name: miq-batch
    datasource:
    url: jdbc:mysql://localhost:3306/scdf
    username: root
    password: root
    driverClassName: org.mariadb.jdbc.Driver
    data:
    mongodb:
    host: localhost
    port: 27017
    database: profile
    jpa:
    properties:
    hibernate:
    implicit_naming_strategy: org.hibernate.boot.model.naming.ImplicitNamingStrategyLegacyHbmImpl
    hbm2ddl:
    auto: update
    cache:
    use_second_level_cache: true
    region.factory_class: org.hibernate.cache.ehcache.EhCacheRegionFactory
    use_query_cache: true
    use_collection_cache: true
    jackson:
    serialization:
    FAIL_ON_EMPTY_BEANS: false









    share|improve this question

























      0












      0








      0








      I just upgraded my spring boot application (Spring Cloud Task) from 1.5 to 2.0.0 (Spring Boot) The jobs in the task/app are running perfectly fine but the jar doesn't close after the jobs are completed. It gets stuck here:



      2018-11-14 18:08:21.711  INFO 7720 --- [           main] o.s.b.c.l.support.SimpleJobLauncher      : Job: [SimpleJob: [name=testJob]] completed with the following parameters: [{-spring.batch.job.names=testJob, run.id=10}] and the following status: [COMPLETED]
      2018-11-14 18:08:21.719 DEBUG 7720 --- [ main] o.s.c.t.r.support.SimpleTaskRepository : Updating: TaskExecution with executionId=16 with the following {exitCode=0, endTime=Wed Nov 14 18:08:21 IST 2018, exitMessage='null', errorMessage='null'}


      After I press ctrl+c on the keyboard the HikariCP shuts down:



      ^C2018-11-14 18:08:25.738  INFO 7720 --- [       Thread-4] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Shutdown initiated...
      2018-11-14 18:08:25.740 INFO 7720 --- [ Thread-4] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Shutdown completed.


      Whereas I want the app/jar to shut down as soon as the jobs are completed.



      After some trial and error, I realized that when I remove the use of second level caching via hibernate in my application.yml it works fine, i.e. the hikariCP shuts down after jobs are completed.
      This is my application.yaml:



      spring:
      application:
      name: miq-batch
      datasource:
      url: jdbc:mysql://localhost:3306/scdf
      username: root
      password: root
      driverClassName: org.mariadb.jdbc.Driver
      data:
      mongodb:
      host: localhost
      port: 27017
      database: profile
      jpa:
      properties:
      hibernate:
      implicit_naming_strategy: org.hibernate.boot.model.naming.ImplicitNamingStrategyLegacyHbmImpl
      hbm2ddl:
      auto: update
      cache:
      use_second_level_cache: true
      region.factory_class: org.hibernate.cache.ehcache.EhCacheRegionFactory
      use_query_cache: true
      use_collection_cache: true
      jackson:
      serialization:
      FAIL_ON_EMPTY_BEANS: false









      share|improve this question














      I just upgraded my spring boot application (Spring Cloud Task) from 1.5 to 2.0.0 (Spring Boot) The jobs in the task/app are running perfectly fine but the jar doesn't close after the jobs are completed. It gets stuck here:



      2018-11-14 18:08:21.711  INFO 7720 --- [           main] o.s.b.c.l.support.SimpleJobLauncher      : Job: [SimpleJob: [name=testJob]] completed with the following parameters: [{-spring.batch.job.names=testJob, run.id=10}] and the following status: [COMPLETED]
      2018-11-14 18:08:21.719 DEBUG 7720 --- [ main] o.s.c.t.r.support.SimpleTaskRepository : Updating: TaskExecution with executionId=16 with the following {exitCode=0, endTime=Wed Nov 14 18:08:21 IST 2018, exitMessage='null', errorMessage='null'}


      After I press ctrl+c on the keyboard the HikariCP shuts down:



      ^C2018-11-14 18:08:25.738  INFO 7720 --- [       Thread-4] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Shutdown initiated...
      2018-11-14 18:08:25.740 INFO 7720 --- [ Thread-4] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Shutdown completed.


      Whereas I want the app/jar to shut down as soon as the jobs are completed.



      After some trial and error, I realized that when I remove the use of second level caching via hibernate in my application.yml it works fine, i.e. the hikariCP shuts down after jobs are completed.
      This is my application.yaml:



      spring:
      application:
      name: miq-batch
      datasource:
      url: jdbc:mysql://localhost:3306/scdf
      username: root
      password: root
      driverClassName: org.mariadb.jdbc.Driver
      data:
      mongodb:
      host: localhost
      port: 27017
      database: profile
      jpa:
      properties:
      hibernate:
      implicit_naming_strategy: org.hibernate.boot.model.naming.ImplicitNamingStrategyLegacyHbmImpl
      hbm2ddl:
      auto: update
      cache:
      use_second_level_cache: true
      region.factory_class: org.hibernate.cache.ehcache.EhCacheRegionFactory
      use_query_cache: true
      use_collection_cache: true
      jackson:
      serialization:
      FAIL_ON_EMPTY_BEANS: false






      java spring hibernate spring-boot spring-cloud-dataflow






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 14 '18 at 12:47









      Siddhant SorannSiddhant Sorann

      246




      246
























          0






          active

          oldest

          votes











          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53300595%2fhikari-cp-not-shutting-down-when-using-second-level-caching-via-hibernate%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes
















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53300595%2fhikari-cp-not-shutting-down-when-using-second-level-caching-via-hibernate%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Bressuire

          Vorschmack

          Quarantine