Made API Services volatile to avoid thread visibility issues

This commit is contained in:
Risto Lahtela 2020-10-11 15:12:26 +03:00
parent 96b9ad8f9b
commit 12a264b1ea
6 changed files with 7 additions and 7 deletions

View File

@ -16,8 +16,8 @@
*/ */
package com.djrapitops.plan.capability; package com.djrapitops.plan.capability;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.function.Consumer; import java.util.function.Consumer;
/** /**
@ -64,6 +64,6 @@ public interface CapabilityService {
} }
class ListHolder { class ListHolder {
static List<Consumer<Boolean>> ENABLE_LISTENERS = new ArrayList<>(); volatile static List<Consumer<Boolean>> ENABLE_LISTENERS = new CopyOnWriteArrayList<>();
} }
} }

View File

@ -88,7 +88,7 @@ public interface ResolverService {
List<Resolver> getResolvers(String target); List<Resolver> getResolvers(String target);
class Holder { class Holder {
static ResolverService service; volatile static ResolverService service;
private Holder() { private Holder() {
/* Static variable holder */ /* Static variable holder */

View File

@ -102,7 +102,7 @@ public interface ResourceService {
} }
class Holder { class Holder {
static ResourceService service; volatile static ResourceService service;
private Holder() { private Holder() {
/* Static variable holder */ /* Static variable holder */

View File

@ -70,7 +70,7 @@ public interface ExtensionService {
void unregister(DataExtension extension); void unregister(DataExtension extension);
class Holder { class Holder {
static ExtensionService service; volatile static ExtensionService service;
private Holder() { private Holder() {
/* Static variable holder */ /* Static variable holder */

View File

@ -149,7 +149,7 @@ public interface QueryService {
} }
class Holder { class Holder {
static QueryService service; volatile static QueryService service;
private Holder() { private Holder() {
/* Static variable holder */ /* Static variable holder */

View File

@ -65,7 +65,7 @@ public interface SettingsService {
List<String> getStringList(String path, Supplier<List<String>> defaultValue); List<String> getStringList(String path, Supplier<List<String>> defaultValue);
class Holder { class Holder {
static SettingsService service; volatile static SettingsService service;
private Holder() { private Holder() {
/* Static variable holder */ /* Static variable holder */