Skip to content

Commit

Permalink
Merge pull request #215 from khappucino/dc/traceHandlerNullCondition
Browse files Browse the repository at this point in the history
made the common ApplicationConfig constructor private, and do a null …
  • Loading branch information
khappucino committed Apr 19, 2018
2 parents 3fbf304 + bf16048 commit b37bcb3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.xjeffrose.xio.application;

import com.google.common.annotations.VisibleForTesting;
import com.typesafe.config.Config;
import com.typesafe.config.ConfigException;
import com.typesafe.config.ConfigFactory;
Expand Down Expand Up @@ -38,7 +39,7 @@ public class ApplicationConfig {
private final Map<String, List<Double>> clientRateLimitOverride =
PlatformDependent.newConcurrentHashMap();

public ApplicationConfig(Config config, XioTracing tracing) {
private ApplicationConfig(Config config, XioTracing tracing) {
this.config = config;
name = config.getString("name");
bossThreads = config.getInt("settings.bossThreads");
Expand All @@ -56,6 +57,7 @@ public ApplicationConfig(Config config, XioTracing tracing) {
this.tracing = tracing;
}

@VisibleForTesting
public ApplicationConfig(Config config, Function<Config, XioTracing> tracingSupplier) {
this(config, tracingSupplier.apply(config));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ public XioServerState(XioServerConfig config) {
}

public ChannelHandler tracingHandler(ApplicationState appState) {
return appState.tracing().newServerHandler(config.isTlsEnabled());
if (appState.tracing() != null) {
return appState.tracing().newServerHandler(config.isTlsEnabled());
} else {
return null;
}
}
}

0 comments on commit b37bcb3

Please sign in to comment.