You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jul 27, 2023. It is now read-only.
I try to create a new session like this: ImmutableSession.builder()
.name(sessionName).ttl("10s").behavior("delete").build()
But the session is not deleted after 10s.
Here is my all code:
@OverRide
public boolean lock(boolean block) {
final boolean[] flag = {true};
List dcList = CONSUL_CLIENT.catalogClient().getDatacenters();
out:
while (true) {
dc:
for (String dc : dcList) {
String sessionIdTemp = createSession(dc);
sessionIdMap.put(dc, sessionIdTemp);
flag[0] = flag[0] && CONSUL_CLIENT.keyValueClient().acquireLock(this.lockKey, sessionIdTemp);
if (!flag[0]) {
logger.warn("try to add request lock in dc:{} failed.", dc);
if (block && times.get() > 0) {
times.decrementAndGet();
continue out;
} else {
return false;
}
} else {
logger.info("try to add request lock in dc:{} success.", dc);
}
}
return flag[0];
}
}
I try to create a new session like this: ImmutableSession.builder()
.name(sessionName).ttl("10s").behavior("delete").build()
But the session is not deleted after 10s.
Here is my all code:
@OverRide
public boolean lock(boolean block) {
final boolean[] flag = {true};
List dcList = CONSUL_CLIENT.catalogClient().getDatacenters();
out:
while (true) {
dc:
for (String dc : dcList) {
String sessionIdTemp = createSession(dc);
sessionIdMap.put(dc, sessionIdTemp);
flag[0] = flag[0] && CONSUL_CLIENT.keyValueClient().acquireLock(this.lockKey, sessionIdTemp);
if (!flag[0]) {
logger.warn("try to add request lock in dc:{} failed.", dc);
if (block && times.get() > 0) {
times.decrementAndGet();
continue out;
} else {
return false;
}
} else {
logger.info("try to add request lock in dc:{} success.", dc);
}
}
return flag[0];
}
}
Thank you so much.
The text was updated successfully, but these errors were encountered: