blob: 9e6a54d8e2c544ca31377a311c71900d413d6efe (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.config.proxy.filedistribution;
import com.yahoo.config.subscription.ConfigSourceSet;
import com.yahoo.jrt.Supervisor;
import com.yahoo.vespa.filedistribution.FileDistributionConnectionPool;
import com.yahoo.vespa.filedistribution.FileDownloader;
import java.time.Duration;
/**
* Keeps track of file distribution and url download rpc servers.
*
* @author hmusum
*/
public class FileDistributionAndUrlDownload {
private final FileDistributionRpcServer fileDistributionRpcServer;
private final UrlDownloadRpcServer urlDownloadRpcServer;
private final FileReferencesAndDownloadsMaintainer maintainer;
public FileDistributionAndUrlDownload(Supervisor supervisor, ConfigSourceSet source) {
fileDistributionRpcServer = new FileDistributionRpcServer(supervisor, createDownloader(supervisor, source));
urlDownloadRpcServer = new UrlDownloadRpcServer(supervisor);
maintainer = new FileReferencesAndDownloadsMaintainer();
}
public void close() {
fileDistributionRpcServer.close();
urlDownloadRpcServer.close();
maintainer.close();
}
private FileDownloader createDownloader(Supervisor supervisor, ConfigSourceSet source) {
return new FileDownloader(new FileDistributionConnectionPool(source, supervisor),
supervisor,
Duration.ofMinutes(5));
}
}
|