|
3 | 3 |
|
4 | 4 | import com.yahoo.config.FileReference;
|
5 | 5 | import com.yahoo.config.provision.ApplicationId;
|
6 |
| -import com.yahoo.config.subscription.ConfigSourceSet; |
7 |
| -import com.yahoo.jrt.Supervisor; |
8 |
| -import com.yahoo.jrt.Transport; |
9 |
| -import com.yahoo.vespa.config.ConnectionPool; |
10 | 6 | import com.yahoo.vespa.config.server.ApplicationRepository;
|
| 7 | +import com.yahoo.vespa.config.server.filedistribution.FileServer; |
11 | 8 | import com.yahoo.vespa.config.server.session.RemoteSession;
|
12 | 9 | import com.yahoo.vespa.config.server.session.Session;
|
13 | 10 | import com.yahoo.vespa.config.server.session.SessionRepository;
|
14 | 11 | import com.yahoo.vespa.config.server.tenant.Tenant;
|
15 | 12 | import com.yahoo.vespa.curator.Curator;
|
16 | 13 | import com.yahoo.vespa.defaults.Defaults;
|
17 |
| -import com.yahoo.vespa.filedistribution.FileDistributionConnectionPool; |
18 | 14 | import com.yahoo.vespa.filedistribution.FileDownloader;
|
19 | 15 | import com.yahoo.vespa.filedistribution.FileReferenceDownload;
|
20 | 16 |
|
|
28 | 24 | import java.util.logging.Logger;
|
29 | 25 |
|
30 | 26 | import static com.yahoo.vespa.config.server.filedistribution.FileDistributionUtil.fileReferenceExistsOnDisk;
|
31 |
| -import static com.yahoo.vespa.config.server.filedistribution.FileDistributionUtil.getOtherConfigServersInCluster; |
32 | 27 | import static com.yahoo.vespa.config.server.session.Session.Status.ACTIVATE;
|
33 | 28 | import static com.yahoo.vespa.config.server.session.Session.Status.PREPARE;
|
34 | 29 |
|
|
43 | 38 | public class ApplicationPackageMaintainer extends ConfigServerMaintainer {
|
44 | 39 |
|
45 | 40 | private static final Logger log = Logger.getLogger(ApplicationPackageMaintainer.class.getName());
|
46 |
| - private static final Duration fileDownloaderTimeout = Duration.ofSeconds(30); |
47 | 41 |
|
48 | 42 | private final File downloadDirectory;
|
49 |
| - private final Supervisor supervisor = new Supervisor(new Transport("filedistribution-pool")).setDropEmptyBuffers(true); |
50 | 43 | private final FileDownloader fileDownloader;
|
51 | 44 |
|
52 |
| - ApplicationPackageMaintainer(ApplicationRepository applicationRepository, Curator curator, Duration interval) { |
| 45 | + ApplicationPackageMaintainer(ApplicationRepository applicationRepository, Curator curator, Duration interval, FileServer fileServer) { |
53 | 46 | super(applicationRepository, curator, applicationRepository.flagSource(), applicationRepository.clock(), interval, false);
|
54 | 47 | this.downloadDirectory = new File(Defaults.getDefaults().underVespaHome(applicationRepository.configserverConfig().fileReferencesDir()));
|
55 |
| - this.fileDownloader = createFileDownloader(applicationRepository, downloadDirectory, supervisor); |
| 48 | + this.fileDownloader = fileServer.downloader(); |
56 | 49 | }
|
57 | 50 |
|
58 | 51 | @Override
|
@@ -121,18 +114,8 @@ private Collection<RemoteSession> preparedAndActivatedSessions() {
|
121 | 114 | .toList();
|
122 | 115 | }
|
123 | 116 |
|
124 |
| - private static FileDownloader createFileDownloader(ApplicationRepository applicationRepository, |
125 |
| - File downloadDirectory, |
126 |
| - Supervisor supervisor) { |
127 |
| - List<String> otherConfigServersInCluster = getOtherConfigServersInCluster(applicationRepository.configserverConfig()); |
128 |
| - ConfigSourceSet configSourceSet = new ConfigSourceSet(otherConfigServersInCluster); |
129 |
| - ConnectionPool connectionPool = new FileDistributionConnectionPool(configSourceSet, supervisor); |
130 |
| - return new FileDownloader(connectionPool, supervisor, downloadDirectory, fileDownloaderTimeout); |
131 |
| - } |
132 |
| - |
133 | 117 | @Override
|
134 | 118 | public void awaitShutdown() {
|
135 |
| - supervisor.transport().shutdown().join(); |
136 | 119 | fileDownloader.close();
|
137 | 120 | super.awaitShutdown();
|
138 | 121 | }
|
|
0 commit comments