diff options
author | PatrikBuhr <patrik.buhr@est.tech> | 2020-10-12 09:59:34 +0200 |
---|---|---|
committer | PatrikBuhr <patrik.buhr@est.tech> | 2020-10-12 10:00:10 +0200 |
commit | 4e948fe8cfed4cb6a9d48f3588962aab9bbb4e3d (patch) | |
tree | 0ef3c27307f4dd5fe98806a0b32c385f1d199c8d /a1-policy-management/src/main | |
parent | 672d820b5807e6b2f9378359e8de817622d0d31c (diff) |
Improvent of usage of AsynchRestClient
Change-Id: I34ce159abacde85cfe7631402491e457d30c7097
Issue-ID: CCSDK-2502
Signed-off-by: PatrikBuhr <patrik.buhr@est.tech>
Diffstat (limited to 'a1-policy-management/src/main')
3 files changed, 11 insertions, 8 deletions
diff --git a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/tasks/RefreshConfigTask.java b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/tasks/RefreshConfigTask.java index 0fee08cf..e4d7d8d7 100644 --- a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/tasks/RefreshConfigTask.java +++ b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/tasks/RefreshConfigTask.java @@ -39,6 +39,7 @@ import lombok.AccessLevel; import lombok.Getter; import org.onap.ccsdk.oran.a1policymanagementservice.clients.A1ClientFactory; +import org.onap.ccsdk.oran.a1policymanagementservice.clients.AsyncRestClientFactory; import org.onap.ccsdk.oran.a1policymanagementservice.configuration.ApplicationConfig; import org.onap.ccsdk.oran.a1policymanagementservice.configuration.ApplicationConfig.RicConfigUpdate; import org.onap.ccsdk.oran.a1policymanagementservice.configuration.ApplicationConfigParser; @@ -92,6 +93,7 @@ public class RefreshConfigTask { private final Policies policies; private final Services services; private final PolicyTypes policyTypes; + private final AsyncRestClientFactory restClientFactory; @Autowired public RefreshConfigTask(ApplicationConfig appConfig, Rics rics, Policies policies, Services services, @@ -102,6 +104,7 @@ public class RefreshConfigTask { this.services = services; this.policyTypes = policyTypes; this.a1ClientFactory = a1ClientFactory; + this.restClientFactory = new AsyncRestClientFactory(appConfig.getWebClientConfig()); } public void start() { @@ -199,7 +202,7 @@ public class RefreshConfigTask { private void removePoliciciesInRic(@Nullable Ric ric) { if (ric != null) { RicSynchronizationTask synch = - new RicSynchronizationTask(a1ClientFactory, policyTypes, policies, services, appConfig); + new RicSynchronizationTask(a1ClientFactory, policyTypes, policies, services, restClientFactory); synch.run(ric); } } @@ -234,7 +237,7 @@ public class RefreshConfigTask { void runRicSynchronization(Ric ric) { RicSynchronizationTask synchronizationTask = - new RicSynchronizationTask(a1ClientFactory, policyTypes, policies, services, appConfig); + new RicSynchronizationTask(a1ClientFactory, policyTypes, policies, services, restClientFactory); synchronizationTask.run(ric); } diff --git a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/tasks/RicSupervision.java b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/tasks/RicSupervision.java index 5ff6d191..cae257cd 100644 --- a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/tasks/RicSupervision.java +++ b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/tasks/RicSupervision.java @@ -24,6 +24,7 @@ import java.util.Collection; import org.onap.ccsdk.oran.a1policymanagementservice.clients.A1Client; import org.onap.ccsdk.oran.a1policymanagementservice.clients.A1ClientFactory; +import org.onap.ccsdk.oran.a1policymanagementservice.clients.AsyncRestClientFactory; import org.onap.ccsdk.oran.a1policymanagementservice.configuration.ApplicationConfig; import org.onap.ccsdk.oran.a1policymanagementservice.exceptions.ServiceException; import org.onap.ccsdk.oran.a1policymanagementservice.repository.Lock.LockType; @@ -59,7 +60,7 @@ public class RicSupervision { private final PolicyTypes policyTypes; private final A1ClientFactory a1ClientFactory; private final Services services; - private final ApplicationConfig config; + private final AsyncRestClientFactory restClientFactory; private static class SynchStartedException extends ServiceException { private static final long serialVersionUID = 1L; @@ -91,7 +92,7 @@ public class RicSupervision { this.a1ClientFactory = a1ClientFactory; this.policyTypes = policyTypes; this.services = services; - this.config = config; + this.restClientFactory = new AsyncRestClientFactory(config.getWebClientConfig()); } /** @@ -210,6 +211,6 @@ public class RicSupervision { } RicSynchronizationTask createSynchronizationTask() { - return new RicSynchronizationTask(a1ClientFactory, policyTypes, policies, services, config); + return new RicSynchronizationTask(a1ClientFactory, policyTypes, policies, services, restClientFactory); } } diff --git a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/tasks/RicSynchronizationTask.java b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/tasks/RicSynchronizationTask.java index df0771cb..cf7ca74e 100644 --- a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/tasks/RicSynchronizationTask.java +++ b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/tasks/RicSynchronizationTask.java @@ -26,7 +26,6 @@ import org.onap.ccsdk.oran.a1policymanagementservice.clients.A1Client; import org.onap.ccsdk.oran.a1policymanagementservice.clients.A1ClientFactory; import org.onap.ccsdk.oran.a1policymanagementservice.clients.AsyncRestClient; import org.onap.ccsdk.oran.a1policymanagementservice.clients.AsyncRestClientFactory; -import org.onap.ccsdk.oran.a1policymanagementservice.configuration.ApplicationConfig; import org.onap.ccsdk.oran.a1policymanagementservice.repository.ImmutablePolicyType; import org.onap.ccsdk.oran.a1policymanagementservice.repository.Lock.LockType; import org.onap.ccsdk.oran.a1policymanagementservice.repository.Policies; @@ -69,12 +68,12 @@ public class RicSynchronizationTask { private final AsyncRestClientFactory restClientFactory; public RicSynchronizationTask(A1ClientFactory a1ClientFactory, PolicyTypes policyTypes, Policies policies, - Services services, ApplicationConfig config) { + Services services, AsyncRestClientFactory restClientFactory) { this.a1ClientFactory = a1ClientFactory; this.policyTypes = policyTypes; this.policies = policies; this.services = services; - this.restClientFactory = new AsyncRestClientFactory(config.getWebClientConfig()); + this.restClientFactory = restClientFactory; } public void run(Ric ric) { |