Skip to content

Commit 7a60d85

Browse files
Fix Embedded jetty NPE issue (#993)
1 parent 996c275 commit 7a60d85

File tree

2 files changed

+11
-9
lines changed

2 files changed

+11
-9
lines changed

datastream-server-restli/src/main/java/com/linkedin/datastream/server/DatastreamServer.java

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -393,15 +393,17 @@ public synchronized void startup() throws DatastreamException {
393393
}
394394

395395
// Start the DMS REST endpoint.
396-
try {
397-
_jettyLauncher.start();
398-
_httpPort = _jettyLauncher.getPort();
399-
// httpPort might be modified when _jettyLauncher start, so set the port of _serverComponentHealthAggregator.
400-
_serverComponentHealthAggregator.setPort(_httpPort);
401-
_isStarted = true;
402-
} catch (Exception ex) {
403-
ErrorLogger.logAndThrowDatastreamRuntimeException(LOG, "Failed to start embedded Jetty.", ex);
396+
if (_jettyLauncher != null) {
397+
try {
398+
_jettyLauncher.start();
399+
_httpPort = _jettyLauncher.getPort();
400+
// httpPort might be modified when _jettyLauncher start, so set the port of _serverComponentHealthAggregator.
401+
_serverComponentHealthAggregator.setPort(_httpPort);
402+
} catch (Exception ex) {
403+
ErrorLogger.logAndThrowDatastreamRuntimeException(LOG, "Failed to start embedded Jetty.", ex);
404+
}
404405
}
406+
_isStarted = true;
405407
}
406408

407409
/**

datastream-server/src/main/java/com/linkedin/datastream/server/DatastreamServerConfigurationConstants.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public final class DatastreamServerConfigurationConstants {
1616
public static final String CONFIG_CSV_METRICS_DIR = CONFIG_PREFIX + "csvMetricsDir";
1717
public static final String CONFIG_ZK_ADDRESS = CoordinatorConfig.CONFIG_ZK_ADDRESS;
1818
public static final String CONFIG_CLUSTER_NAME = CoordinatorConfig.CONFIG_CLUSTER;
19-
public static final String CONFIG_ENABLE_EMBEDDED_JETTY = "enableEmbeddedJetty";
19+
public static final String CONFIG_ENABLE_EMBEDDED_JETTY = CONFIG_PREFIX + "enableEmbeddedJetty";
2020
public static final String CONFIG_FACTORY_CLASS_NAME = "factoryClassName";
2121
public static final String CONFIG_CONNECTOR_BOOTSTRAP_TYPE = "bootstrapConnector";
2222
public static final String CONFIG_CONNECTOR_ASSIGNMENT_STRATEGY_FACTORY = "assignmentStrategyFactory";

0 commit comments

Comments
 (0)