Skip to content

Commit

Permalink
fix ci
Browse files Browse the repository at this point in the history
  • Loading branch information
HMYDK committed Sep 2, 2024
1 parent 98a6e22 commit a9f73e9
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,13 @@ public class ProtocolManager extends MemberChangeListener implements DisposableB

private final ServerMemberManager memberManager;

private boolean apInit = false;
private volatile boolean apInit = false;

private boolean cpInit = false;
private volatile boolean cpInit = false;

private final Object cpLock = new Object();

private final Object apLock = new Object();

private Set<Member> oldMembers;

Expand All @@ -80,20 +84,24 @@ public static Set<String> toCPMembersInfo(Collection<Member> members) {
}

public CPProtocol getCpProtocol() {
synchronized (this) {
if (!cpInit) {
initCPProtocol();
cpInit = true;
if (!cpInit){
synchronized (cpLock) {
if (!cpInit) {
initCPProtocol();
cpInit = true;
}
}
}
return cpProtocol;
}

public APProtocol getApProtocol() {
synchronized (this) {
if (!apInit) {
initAPProtocol();
apInit = true;
if (!apInit) {
synchronized (apLock) {
if (!apInit) {
initAPProtocol();
apInit = true;
}
}
}
return apProtocol;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,11 +151,8 @@ public static <T> T getBean(Class<T> requiredType) throws BeansException {
}

public static <T> void getBeanIfExist(Class<T> requiredType, Consumer<T> consumer) throws BeansException {
try {
T bean = applicationContext.getBean(requiredType);
consumer.accept(bean);
} catch (NoSuchBeanDefinitionException ignore) {
}
T bean = applicationContext.getBean(requiredType);
consumer.accept(bean);
}

public static <T> T getBean(Class<T> requiredType, Object... args) throws BeansException {
Expand Down

0 comments on commit a9f73e9

Please sign in to comment.