Skip to content

Commit 86c473e

Browse files
Changing the way the getInstance is synchronized
1 parent 97e604f commit 86c473e

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

client/src/main/java/io/split/client/ApiKeyCounter.java

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,9 @@ public class ApiKeyCounter {
1515

1616
private ApiKeyCounter() {}
1717

18-
public static ApiKeyCounter getApiKeyCounterInstance() {
18+
public static synchronized ApiKeyCounter getApiKeyCounterInstance() {
1919
if(_apiKeyCounter == null) {
20-
synchronized (ApiKeyCounter.class) {
21-
if (_apiKeyCounter == null) {
22-
_apiKeyCounter = new ApiKeyCounter();
23-
}
24-
}
20+
_apiKeyCounter = new ApiKeyCounter();
2521
}
2622

2723
return _apiKeyCounter;

0 commit comments

Comments
 (0)