title: spring integration leader election jdbc not working on disconnect
body: <p>I am trying to use the leader election in spring-integration using JDBC. It works, as long as the database is connected. As soon as the database connection is dropped, the leader election stops working and the leader information on that node stays the same.</p>
  
  <p>As far as I understood the code, there is an exception thrown when the connection is lost. The leader election then tries to remove the lock in the database (of course this is not possible) and another exception is thrown and the executor service stops running. (finally block in LockRegistryLeaderInitiator call() method)</p>
  
  <p>Do I have to react on the database disconnection? Do I have to configure something?</p>
  
  <p>Steps to reproduce:</p>
  
  <ul>
  <li>Start the first service</li>
  <li>check that it is the leader</li>
  <li>stop the database</li>
  <li>the instance is still the leader</li>
  <li>start the database again</li>
  <li>start a second instance</li>
  <li>both are now leader</li>
  </ul>
  
  <p>dependencies:</p>
  
  <pre><code>&lt;parent&gt;
      &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
      &lt;artifactId&gt;spring-boot-starter-parent&lt;/artifactId&gt;
      &lt;version&gt;1.5.10.RELEASE&lt;/version&gt;
  &lt;/parent&gt;
  &lt;dependency&gt;
    &lt;groupId&gt;org.springframework.integration&lt;/groupId&gt;
    &lt;artifactId&gt;spring-integration-core&lt;/artifactId&gt;
  &lt;/dependency&gt;
  &lt;dependency&gt;
    &lt;groupId&gt;org.springframework.integration&lt;/groupId&gt;
    &lt;artifactId&gt;spring-integration-jdbc&lt;/artifactId&gt;
  &lt;/dependency&gt;
  </code></pre>
  
  <p>LeaderElectionConfiguration</p>
  
  <pre><code>@Configuration
  public class LeaderElectionConfiguration {
  
  @Bean
  public LockRegistry lockRegistry(LockRepository lockRepository) {
      return new JdbcLockRegistry(lockRepository);
  }
  
  @Bean
  public DefaultLockRepository lockRepository(DataSource dataSource) {
      return new DefaultLockRepository(dataSource);
  }
  
  @Bean
  public LockRegistryLeaderInitiator leaderInitiator(LockRegistry lockRegistry) {
      LockRegistryLeaderInitiator lockRegistryLeaderInitiator = new LockRegistryLeaderInitiator(lockRegistry);
      lockRegistryLeaderInitiator.start();
      return lockRegistryLeaderInitiator;
  }
  </code></pre>
  
  <p>}</p>
  
  <p>jdbc config:</p>
  
  <pre><code>spring:
    datasource:
      initialize: false
      url: jdbc:mysql://localhost:3306/whatever
      username: admin
      password: adminpw
      driver-class-name: com.mysql.cj.jdbc.Driver
  </code></pre>