this.configuration = configuration;
}
@Override
public void doRun() {
final URIBuilder uri;
final HttpGet get;
try {
uri = new URIBuilder(configuration.getVersionchecksUri());
uri.addParameter("anonid", DigestUtils.sha256Hex(serverStatus.getNodeId().toString()));
uri.addParameter("version", ServerVersion.VERSION.toString());
get = new HttpGet(uri.build());
get.setHeader("User-Agent",
"graylog2-server ("
+ System.getProperty("java.vendor") + ", "
+ System.getProperty("java.version") + ", "
+ System.getProperty("os.name") + ", "
+ System.getProperty("os.version") + ")");
final RequestConfig.Builder configBuilder = RequestConfig.custom()
.setConnectTimeout(configuration.getVersionchecksConnectTimeOut())
.setSocketTimeout(configuration.getVersionchecksSocketTimeOut())
.setConnectionRequestTimeout(configuration.getVersionchecksConnectionRequestTimeOut());
if (configuration.getHttpProxyUri() != null) {
try {
final URIBuilder uriBuilder = new URIBuilder(configuration.getHttpProxyUri());
final URI proxyURI = uriBuilder.build();
configBuilder.setProxy(new HttpHost(proxyURI.getHost(), proxyURI.getPort(), proxyURI.getScheme()));
} catch (Exception e) {
LOG.error("Invalid version check proxy URI: " + configuration.getHttpProxyUri(), e);
return;