Class RedisLeaderElection

  • All Implemented Interfaces:
    de.otto.synapse.leaderelection.LeaderElection

    @Beta
    public class RedisLeaderElection
    extends java.lang.Object
    implements de.otto.synapse.leaderelection.LeaderElection
    • Constructor Summary

      Constructors 
      Constructor Description
      RedisLeaderElection​(org.redisson.api.RedissonClient redissonClient)  
    • Method Summary

      Modifier and Type Method Description
      java.util.concurrent.CompletableFuture<java.lang.Void> runAsyncIfLeader​(java.lang.String lockName, java.lang.Runnable runnable)  
      java.util.concurrent.CompletableFuture<java.lang.Void> runAsyncIfLeader​(java.lang.String lockName, java.lang.Runnable runnable, java.util.concurrent.Executor executor)  
      void runIfLeader​(java.lang.String lockName, java.lang.Runnable runnable)  
      <T> java.util.concurrent.CompletableFuture<T> supplyAsyncIfLeader​(java.lang.String lockName, java.util.function.Supplier<T> supplier)  
      <T> java.util.concurrent.CompletableFuture<T> supplyAsyncIfLeader​(java.lang.String lockName, java.util.function.Supplier<T> supplier, java.util.concurrent.Executor executor)  
      <T> T supplyIfLeader​(java.lang.String lockName, java.util.function.Supplier<T> supplier)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • RedisLeaderElection

        public RedisLeaderElection​(org.redisson.api.RedissonClient redissonClient)
    • Method Detail

      • runAsyncIfLeader

        public final java.util.concurrent.CompletableFuture<java.lang.Void> runAsyncIfLeader​(java.lang.String lockName,
                                                                                             java.lang.Runnable runnable)
        Specified by:
        runAsyncIfLeader in interface de.otto.synapse.leaderelection.LeaderElection
      • runAsyncIfLeader

        public final java.util.concurrent.CompletableFuture<java.lang.Void> runAsyncIfLeader​(java.lang.String lockName,
                                                                                             java.lang.Runnable runnable,
                                                                                             java.util.concurrent.Executor executor)
        Specified by:
        runAsyncIfLeader in interface de.otto.synapse.leaderelection.LeaderElection
      • supplyAsyncIfLeader

        public final <T> java.util.concurrent.CompletableFuture<T> supplyAsyncIfLeader​(java.lang.String lockName,
                                                                                       java.util.function.Supplier<T> supplier)
        Specified by:
        supplyAsyncIfLeader in interface de.otto.synapse.leaderelection.LeaderElection
      • supplyAsyncIfLeader

        public final <T> java.util.concurrent.CompletableFuture<T> supplyAsyncIfLeader​(java.lang.String lockName,
                                                                                       java.util.function.Supplier<T> supplier,
                                                                                       java.util.concurrent.Executor executor)
        Specified by:
        supplyAsyncIfLeader in interface de.otto.synapse.leaderelection.LeaderElection
      • runIfLeader

        public final void runIfLeader​(java.lang.String lockName,
                                      java.lang.Runnable runnable)
        Specified by:
        runIfLeader in interface de.otto.synapse.leaderelection.LeaderElection
      • supplyIfLeader

        public final <T> T supplyIfLeader​(java.lang.String lockName,
                                          java.util.function.Supplier<T> supplier)
        Specified by:
        supplyIfLeader in interface de.otto.synapse.leaderelection.LeaderElection