use of org.cloudfoundry.client.v2.shareddomains.SharedDomainEntity in project promregator by promregator.
the class ReactiveAppInstanceScanner method getDomain.
private Mono<String> getDomain(String domainIdString) {
String key = domainIdString;
synchronized (key.intern()) {
Mono<String> cached = this.domainMap.get(key);
if (cached != null) {
this.internalMetrics.countHit("appinstancescanner.domain");
return cached;
}
this.internalMetrics.countMiss("appinstancescanner.domain");
ReactiveTimer reactiveTimer = new ReactiveTimer(this.internalMetrics, "domain");
cached = Mono.just(domainIdString).zipWith(Mono.just(reactiveTimer)).map(tuple -> {
tuple.getT2().start();
return tuple.getT1();
}).flatMap(domainId -> {
return this.cfAccessor.retrieveSharedDomain(domainId);
}).map(response -> {
SharedDomainEntity sharedDomain = response.getEntity();
return sharedDomain.getName();
}).zipWith(Mono.just(reactiveTimer)).map(tuple -> {
tuple.getT2().stop();
return tuple.getT1();
}).cache();
this.domainMap.put(key, cached);
return cached;
}
}
use of org.cloudfoundry.client.v2.shareddomains.SharedDomainEntity in project promregator by promregator.
the class CFAccessorMock method retrieveSharedDomain.
@Override
public Mono<GetSharedDomainResponse> retrieveSharedDomain(String domainId) {
if (domainId.equals(UNITTEST_SHARED_DOMAIN_UUID)) {
SharedDomainEntity entity = SharedDomainEntity.builder().name(UNITTEST_SHARED_DOMAIN).build();
GetSharedDomainResponse resp = GetSharedDomainResponse.builder().entity(entity).build();
return Mono.just(resp);
}
Assert.fail("Invalid shared domain request");
return null;
}
Aggregations