This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.*; | |
import java.util.concurrent.atomic.AtomicInteger; | |
public class WeightRandom<T> { | |
ThreadLocal<Random> threadLocalRandom = ThreadLocal.withInitial(Random::new); | |
private final List<T> items = new ArrayList<>(); | |
private double[] weights; | |
public WeightRandom(List<ItemWithWeight<T>> itemsWithWeight) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Unit] | |
Description=IRON consumer service | |
# 网络就绪后执行 | |
After=network.target | |
[Service] | |
# | |
Type=simple | |
# 当服务进程 正常退出、异常退出、被杀死、超时的时候, 是否重新启动该服务,可选的值包括 always(总是重启)、on-success、on-failure、on-abnormal、on-abort、on-watchdog | |
Restart=always |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
git reset --hard 6c98c09e4ccf3e1808a0c0e40de637b63ae1ebbb // 回退到某一个提交 | |
git push -f |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.springframework.beans.factory.annotation.Autowired; | |
import org.springframework.data.redis.core.RedisCallback; | |
import org.springframework.data.redis.core.StringRedisTemplate; | |
import org.springframework.stereotype.Service; | |
import redis.clients.jedis.Jedis; | |
import java.util.Collections; | |
@Service | |
public class RedisLock { |