8000 GitHub - huangyemin/wheel: 有用的轮子
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

huangyemin/wheel

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

有用的轮子

主从选举

基于redisson的RLock实现的主从选举(leader election)

spring boot中的使用示例:

@Value("${spring.application.name}")
private String appName;

@Bean(destroyMethod = "shutdown")
public LeaderElection leaderElection(RedissonClient redissonClient) {
    LeaderElection leaderElection = new LeaderElection();
    leaderElection.setRedissonClient(redissonClient);
    leaderElection.tryHold("leader-lock-" + appName);
    return leaderElection;
}

About

有用的轮子

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

0