Skip to content

Commit

Permalink
removed some additional apm related code
Browse files Browse the repository at this point in the history
  • Loading branch information
noMoreCLI committed Dec 6, 2024
1 parent efb7852 commit d833248
Showing 1 changed file with 4 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,20 +50,13 @@ public static void main(String[] args) throws Exception {

logger.info("Reading AppConfig");
String envAppConfig = System.getenv("APP_CONFIG");
String envApmConfig = System.getenv("APM_CONFIG");

if (envAppConfig == null) {
envAppConfig = "{\"endpoints\":{\"http\":{}}}";
}

if (envApmConfig == null) {
envApmConfig = "{}";
}

JsonReader jsonReader = Json.createReader(new StringReader(envAppConfig));
JsonObject config = jsonReader.readObject();
jsonReader = Json.createReader(new StringReader(envApmConfig));
JsonObject apmConfig = jsonReader.readObject();

CacheManager cm = CacheManager.getInstance();

Expand All @@ -76,7 +69,7 @@ public static void main(String[] args) throws Exception {
ServletHandler handler = new ServletHandler();
server.setHandler(handler);
logger.info("NodeServlet setConfig");
NodeServlet.setConfig(config, apmConfig);
NodeServlet.setConfig(config);

handler.addServletWithMapping(NodeServlet.class, "/*");

Expand All @@ -87,12 +80,10 @@ public static void main(String[] args) throws Exception {
@SuppressWarnings("serial")
public static class NodeServlet extends HttpServlet {
protected static JsonObject config;
protected static JsonObject apmConfig;
protected static JsonObject endpoints;

public static void setConfig(JsonObject config, JsonObject apmConfig) {
public static void setConfig(JsonObject configg) {
NodeServlet.config = config;
NodeServlet.apmConfig = apmConfig;
NodeServlet.endpoints = config.getJsonObject("endpoints").getJsonObject("http");
logger.info("Config: {}", config.toString());
logger.info("Config: {}", config.getJsonObject("endpoints").getJsonObject("http").toString());
Expand All @@ -113,10 +104,10 @@ protected String loadFromCache(int timeout) {
long start = System.currentTimeMillis();
long finish = start;
int i = 0;
Integer element = new Integer(0);
Integer element = Integer.valueOf(0);
while (finish - start < timeout) {
i++;
element = new Integer(i);
element = Integer.valueOf(i);
cache.putIfAbsent(new Element(element, i));
finish = System.currentTimeMillis();
}
Expand Down

0 comments on commit d833248

Please sign in to comment.