Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public class NodeManager {
@Getter
protected AbstractEaasComponent currentComponent;

private final ThreadLocal<ComponentConfiguration> loadedComponentConfiguration = ThreadLocal.withInitial(() -> null);
private ComponentConfiguration loadedComponentConfiguration = null;

@Inject
@ConfigProperty(name = "components.warmup_timeout")
Expand Down Expand Up @@ -107,7 +107,7 @@ public void init() throws BWFLAException {

String data = new String(is.readAllBytes(), StandardCharsets.UTF_8);

loadedComponentConfiguration.set(objectMapper.readValue(data, ComponentConfiguration.class));
loadedComponentConfiguration = objectMapper.readValue(data, ComponentConfiguration.class);
configurationLoadedOnInit.getAndSet(true);

currentComponent = createComponentInstance();
Expand Down Expand Up @@ -199,7 +199,7 @@ protected AbstractEaasComponent createComponentInstance() throws BWFLAException
try {
AbstractEaasComponent component;
String componentId = UUID.randomUUID().toString();
ComponentConfiguration configuration = loadedComponentConfiguration.get();
ComponentConfiguration configuration = loadedComponentConfiguration;

if (configuration instanceof MachineConfiguration) {
component = EmulatorBean.createEmulatorBean((MachineConfiguration) configuration);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
package de.bwl.bwfla.emucomp.components;

import com.fasterxml.jackson.databind.ObjectMapper;
import de.bwl.bwfla.emucomp.common.*;
import de.bwl.bwfla.emucomp.common.ComponentConfiguration;
import de.bwl.bwfla.emucomp.common.FileCollection;
import de.bwl.bwfla.emucomp.common.ImageArchiveBinding;
import de.bwl.bwfla.emucomp.common.MachineConfiguration;
import lombok.extern.slf4j.Slf4j;

import java.io.File;
Expand All @@ -21,11 +24,11 @@ public class BindingsResolver {

private static final String _classpath_DEFAULT_CONFIGURATION_PATH = "/config";

public static volatile String providedConfigurationPath;
public static String providedConfigurationPath;
private static StringBuffer extractedConfigurationHolder;
private static ComponentConfiguration extractedComponentConfiguration;

private static final ThreadLocal<ObjectMapper> mapperThreadLocal = ThreadLocal.withInitial(ObjectMapper::new);
private static final ObjectMapper obj = new ObjectMapper();

public static Optional<FileCollection> findFileCollectionDeclaration(String objectArchive, String id) {
tryExtractConfiguration();
Expand Down Expand Up @@ -131,9 +134,9 @@ private static void loadConfiguration(String path) {
String data = new String(is.readAllBytes(), StandardCharsets.UTF_8);
extractedConfigurationHolder = new StringBuffer(data);

extractedComponentConfiguration = mapperThreadLocal.get().readValue(data, MachineConfiguration.class);
extractedComponentConfiguration = obj.readValue(data, ComponentConfiguration.class);
} catch (IOException e) {
log.error("Cannot load configuration from {}", path, e);
log.error("Cannot load configuration from {}", path);
}
}
}

This file was deleted.

Loading