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 @@ -393,15 +393,17 @@ public synchronized void startup() throws DatastreamException {
}

// Start the DMS REST endpoint.
try {
_jettyLauncher.start();
_httpPort = _jettyLauncher.getPort();
// httpPort might be modified when _jettyLauncher start, so set the port of _serverComponentHealthAggregator.
_serverComponentHealthAggregator.setPort(_httpPort);
_isStarted = true;
} catch (Exception ex) {
ErrorLogger.logAndThrowDatastreamRuntimeException(LOG, "Failed to start embedded Jetty.", ex);
if (_jettyLauncher != null) {
try {
_jettyLauncher.start();
_httpPort = _jettyLauncher.getPort();
// httpPort might be modified when _jettyLauncher start, so set the port of _serverComponentHealthAggregator.
_serverComponentHealthAggregator.setPort(_httpPort);
} catch (Exception ex) {
ErrorLogger.logAndThrowDatastreamRuntimeException(LOG, "Failed to start embedded Jetty.", ex);
}
}
_isStarted = true;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We want this flag to be true only when the server has successfully started right? here we may end up setting it to true even if there was an exception starting up?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My rationale for keeping the _isStarted separate and true is the Coordinator is the core component which handles all the datastream processing, task assignment, and coordination logic. If the Coordinator starts successfully, the overall server IS operational.

_isStarted is true if startup succeeded - Even without embedded Jetty, the server has:
- Started the JMX reporter
- Started the Coordinator
- (Optionally) Started embedded Jetty

}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public final class DatastreamServerConfigurationConstants {
public static final String CONFIG_CSV_METRICS_DIR = CONFIG_PREFIX + "csvMetricsDir";
public static final String CONFIG_ZK_ADDRESS = CoordinatorConfig.CONFIG_ZK_ADDRESS;
public static final String CONFIG_CLUSTER_NAME = CoordinatorConfig.CONFIG_CLUSTER;
public static final String CONFIG_ENABLE_EMBEDDED_JETTY = "enableEmbeddedJetty";
public static final String CONFIG_ENABLE_EMBEDDED_JETTY = CONFIG_PREFIX + "enableEmbeddedJetty";
public static final String CONFIG_FACTORY_CLASS_NAME = "factoryClassName";
public static final String CONFIG_CONNECTOR_BOOTSTRAP_TYPE = "bootstrapConnector";
public static final String CONFIG_CONNECTOR_ASSIGNMENT_STRATEGY_FACTORY = "assignmentStrategyFactory";
Expand Down