void converge() {
        DataplaneProxyConfig config;
        Path proxyCredentialsCert;
        Path proxyCredentialsKey;
        synchronized (this) {
            config = cfg;
            proxyCredentialsCert = this.proxyCredentialsCert;
            proxyCredentialsKey = this.proxyCredentialsKey;
            this.cfg = null;
            this.proxyCredentialsCert = null;
            this.proxyCredentialsKey = null;
        }
        if (config != null) {
            try {

                String serverCert = config.serverCertificate();
                String serverKey = config.serverKey();

                boolean configChanged = false;
                configChanged |= writeFile(serverCertificateFile, serverCert);
                configChanged |= writeFile(serverKeyFile, serverKey);
                configChanged |= writeFile(nginxConf,
                                           nginxConfig(
                                                   configTemplate,
                                                   proxyCredentialsCert,
                                                   proxyCredentialsKey,
                                                   serverCertificateFile,
                                                   serverKeyFile,
                                                   config.mtlsPort(),
                                                   config.tokenPort(),
                                                   config.tokenEndpoints(),
                                                   root,
                                                   useAzureProxy,
                                                   isDevEnvironment));
                if (configChanged) {
                    logger.log(Level.INFO, "Configuring data plane proxy service. Token endpoints: [%s]"
                            .formatted(String.join(", ", config.tokenEndpoints())));
                }
                if (configChanged && state == NginxState.RUNNING) {
                    changeState(NginxState.RELOAD_REQUIRED);
                }
            } catch (IOException e) {
                throw new RuntimeException("Error reconfiguring data plane proxy", e);
            }
        }
        NginxState convergeTo = wantedState;
        if (convergeTo == NginxState.RUNNING) {
            boolean nginxRunning = proxyCommands.isRunning();
            if (!nginxRunning) {
                try {
                    proxyCommands.start(nginxConf);
                    changeState(convergeTo);
                } catch (Exception e) {
                    logger.log(Level.INFO, "Failed to start nginx, will retry");
                    logger.log(Level.FINE, "Exception from nginx start", e);
                }
            } else {
                if (state == NginxState.RELOAD_REQUIRED) {
                    try {
                        proxyCommands.reload(nginxConf);
                        changeState(convergeTo);
                    } catch (Exception e) {
                        logger.log(Level.INFO, "Failed to reconfigure nginx, will retry.");
                        logger.log(Level.FINE, "Exception from nginx reload", e);
                    }
                } else if (state != convergeTo) {
                    // Already running, but state not updated
                    changeState(convergeTo);
                }
            }
        } else if (convergeTo == NginxState.STOPPED) {
            if (proxyCommands.isRunning()) {
                try {
                    proxyCommands.stop(nginxConf);
                } catch (Exception e) {
                    logger.log(Level.INFO, "Failed to stop nginx, will retry");
                    logger.log(Level.FINE, "Exception from nginx stop", e);
                }
            }
            if (! proxyCommands.isRunning()) {
                changeState(convergeTo);
                executorService.shutdownNow();
            }
        } else {
            logger.warning("Unknown state " + convergeTo);
        }
    }
Configures a data plane proxy. Currently using Nginx.

@author mortent
container-disc/src/main/java/com/yahoo/container/jdisc/DataplaneProxyService.java