4747import google .registry .model .registrar .RegistrarPoc ;
4848import google .registry .model .reporting .HistoryEntry ;
4949import google .registry .model .reporting .HistoryEntryDao ;
50+ import google .registry .persistence .VKey ;
5051import google .registry .rdap .RdapDataStructures .Event ;
5152import google .registry .rdap .RdapDataStructures .EventAction ;
5253import google .registry .rdap .RdapDataStructures .Link ;
@@ -352,6 +353,8 @@ RdapDomain createRdapDomain(Domain domain, OutputDataType outputDataType) {
352353 }
353354 // RDAP Response Profile 2.6.1: must have at least one status member
354355 // makeStatusValueList should in theory always contain one of either "active" or "inactive".
356+ // RDAP Response Profile 2.6.3, must have a notice about statuses. That is in {@link
357+ // RdapIcannStandardInformation#domainBoilerplateNotices}, not here.
355358 Set <EppEnum > allStatusValues =
356359 Sets .union (domain .getStatusValues (), domain .getGracePeriodStatuses ());
357360 ImmutableSet <RdapStatus > status =
@@ -365,14 +368,21 @@ RdapDomain createRdapDomain(Domain domain, OutputDataType outputDataType) {
365368 "Domain %s (ROID %s) doesn't have any status." ,
366369 domain .getDomainName (), domain .getRepoId ());
367370 }
368- // RDAP Response Profile 2.6.3, must have a notice about statuses. That is in {@link
369- // RdapIcannStandardInformation#domainBoilerplateNotices}
370371
372+ // We're just trying to load the hosts by cache here, but the generics and casting require
373+ // a lot of boilerplate to make the compiler happy
374+ Iterable <VKey <? extends EppResource >> nameservers =
375+ ImmutableSet .copyOf (domain .getNameservers ());
371376 ImmutableSet <Host > loadedHosts =
372377 replicaTm ()
373378 .transact (
374- () ->
375- ImmutableSet .copyOf (replicaTm ().loadByKeys (domain .getNameservers ()).values ()));
379+ () -> {
380+ ImmutableSet .Builder <Host > hostBuilder = new ImmutableSet .Builder <>();
381+ for (EppResource host : EppResource .loadByCacheIfEnabled (nameservers ).values ()) {
382+ hostBuilder .add ((Host ) host );
383+ }
384+ return hostBuilder .build ();
385+ });
376386
377387 // Add the nameservers to the data; the load was kicked off above for efficiency.
378388 // RDAP Response Profile 2.8: we MUST have the nameservers
@@ -425,8 +435,7 @@ RdapNameserver createRdapNameserver(Host host, OutputDataType outputDataType) {
425435 && replicaTm ()
426436 .transact (
427437 () ->
428- replicaTm ()
429- .loadByKey (host .getSuperordinateDomain ())
438+ EppResource .loadByCache (host .getSuperordinateDomain ())
430439 .cloneProjectedAtTime (getRequestTime ())
431440 .getStatusValues ()
432441 .contains (StatusValue .PENDING_TRANSFER ))) {
0 commit comments