blob: 4212874c1a8eb4a3071c9758b5429a4eaf888cd3 (
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
|
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.container.core.documentapi;
import com.yahoo.component.annotation.Inject;
import com.yahoo.container.di.componentgraph.Provider;
import com.yahoo.document.config.DocumentmanagerConfig;
import com.yahoo.documentapi.messagebus.protocol.DocumentProtocolPoliciesConfig;
import com.yahoo.messagebus.MessagebusConfig;
import com.yahoo.vespa.config.content.DistributionConfig;
/**
* Lets a lazily initialised DocumentAccess that forwards to a MessageBusDocumentAccess be injected in containers.
*
* @author jonmv
*/
public class DocumentAccessProvider implements Provider<VespaDocumentAccess> {
private final VespaDocumentAccess access;
@Inject
public DocumentAccessProvider(DocumentmanagerConfig documentmanagerConfig,
MessagebusConfig messagebusConfig, DocumentProtocolPoliciesConfig policiesConfig,
DistributionConfig distributionConfig) {
this.access = new VespaDocumentAccess(documentmanagerConfig, System.getProperty("config.id"),
messagebusConfig, policiesConfig, distributionConfig);
}
@Override
public VespaDocumentAccess get() {
return access;
}
@Override
public void deconstruct() {
access.protectedShutdown();
}
}
|