Skip to content

Commit

Permalink
FIX: Change syncronization tool in getVersion().
Browse files Browse the repository at this point in the history
  • Loading branch information
brido4125 authored and jhpark816 committed Jul 31, 2023
1 parent 6e2c63b commit 6998801
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/main/java/net/spy/memcached/ArcusClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -184,8 +184,8 @@
* }</pre>
*/
public class ArcusClient extends FrontCacheMemcachedClient implements ArcusClientIF {

private static String VERSION = "INIT";
private static String VERSION = null;
private static final Object VERSION_LOCK = new Object();
private static final Logger arcusLogger = LoggerFactory.getLogger(ArcusClient.class);
private static final String ARCUS_CLOUD_ADDR = "127.0.0.1:2181";
private static final String DEFAULT_ARCUS_CLIENT_NAME = "ArcusClient";
Expand Down Expand Up @@ -4273,11 +4273,11 @@ private void checkDupKey(Collection<String> keyList) {
* @return version string
*/
public static String getVersion() {
if (!VERSION.equals("INIT")) {
if (VERSION != null) {
return VERSION;
}
synchronized (VERSION) {
if (VERSION.equals("INIT")) {
synchronized (VERSION_LOCK) {
if (VERSION == null) {
Enumeration<URL> resEnum;
try {
resEnum = Thread.currentThread()
Expand All @@ -4298,7 +4298,7 @@ public static String getVersion() {
} catch (Exception e) {
// Failed to get version.
} finally {
if (VERSION.equals("INIT")) {
if (VERSION == null) {
VERSION = "NONE";
}
}
Expand Down

0 comments on commit 6998801

Please sign in to comment.