Skip to content

Commit

Permalink
0005772: Add cluster information to info URI
Browse files Browse the repository at this point in the history
  • Loading branch information
erilong committed Apr 5, 2023
1 parent 93917d0 commit d82b6bc
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
Expand Up @@ -34,6 +34,7 @@
import org.jumpmind.symmetric.common.ParameterConstants;
import org.jumpmind.symmetric.model.Node;
import org.jumpmind.symmetric.model.NodeGroupLink;
import org.jumpmind.symmetric.service.IClusterService;
import org.jumpmind.symmetric.service.IConfigurationService;
import org.jumpmind.symmetric.service.INodeService;
import org.jumpmind.symmetric.service.IParameterService;
Expand All @@ -44,13 +45,15 @@
public class InfoUriHandler extends AbstractUriHandler {
private INodeService nodeService;
private IConfigurationService configurationService;
private IClusterService clusterService;

public InfoUriHandler(IParameterService parameterService,
INodeService nodeService,
IConfigurationService configurationService, IInterceptor[] interceptors) {
IConfigurationService configurationService, IClusterService clusterService, IInterceptor[] interceptors) {
super("/info/*", parameterService, interceptors);
this.nodeService = nodeService;
this.configurationService = configurationService;
this.clusterService = clusterService;
}

public void handle(HttpServletRequest req, HttpServletResponse res) throws IOException,
Expand Down Expand Up @@ -93,6 +96,11 @@ public void handle(HttpServletRequest req, HttpServletResponse res) throws IOExc
}
}
properties.setProperty(InfoConstants.BULK_LOADER_ENABLED, String.valueOf(configurationService.isBulkLoaderEnabled()));
boolean isClustered = parameterService.is(ParameterConstants.CLUSTER_LOCKING_ENABLED);
properties.setProperty(ParameterConstants.CLUSTER_LOCKING_ENABLED, Boolean.toString(isClustered));
if (isClustered) {
properties.setProperty(ParameterConstants.CLUSTER_SERVER_ID, clusterService.getServerId());
}
properties.store(res.getOutputStream(), "SymmetricDS");
res.flushBuffer();
}
Expand Down
Expand Up @@ -91,7 +91,7 @@ protected void init() {
add(customInterceptors, authInterceptor, concurrencyInterceptor)));
this.uriHandlers.add(new PingUriHandler(parameterService, customInterceptors));
this.uriHandlers
.add(new InfoUriHandler(parameterService, nodeService, configurationService, customInterceptors));
.add(new InfoUriHandler(parameterService, nodeService, configurationService, clusterService, customInterceptors));
this.uriHandlers.add(new BandwidthSamplerUriHandler(parameterService, add(customInterceptors, authInterceptor, concurrencyInterceptor)));
this.uriHandlers.add(new PullUriHandler(parameterService, nodeService,
configurationService, dataExtractorService, registrationService, statisticManager, outgoingBatchService,
Expand Down

0 comments on commit d82b6bc

Please sign in to comment.