Deprecate more fields in RegistryConfig

This primarily addresses issues with TMCH testing mode and email sending utils.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=143710550
This commit is contained in:
mcilwain 2017-01-05 14:38:38 -08:00 committed by Ben McIlwain
parent c05424b947
commit 25a8bbe890
23 changed files with 203 additions and 265 deletions

View file

@ -19,6 +19,7 @@ import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkNotNull;
import static com.google.common.base.Preconditions.checkState;
import static com.google.common.collect.Iterables.partition;
import static google.registry.config.RegistryConfig.getDomainLabelListCacheDuration;
import static google.registry.model.common.EntityGroupRoot.getCrossTldKey;
import static google.registry.model.ofy.ObjectifyService.allocateId;
import static google.registry.model.ofy.ObjectifyService.ofy;
@ -48,7 +49,6 @@ import com.googlecode.objectify.annotation.Ignore;
import com.googlecode.objectify.annotation.OnLoad;
import com.googlecode.objectify.annotation.Parent;
import com.googlecode.objectify.cmd.Query;
import google.registry.config.RegistryEnvironment;
import google.registry.model.Buildable;
import google.registry.model.ImmutableObject;
import google.registry.model.annotations.ReportedOn;
@ -97,24 +97,22 @@ public final class PremiumList extends BaseDomainLabelList<Money, PremiumList.Pr
}
}
private static LoadingCache<String, PremiumList> cache = CacheBuilder
.newBuilder()
.expireAfterWrite(
RegistryEnvironment.get().config().getDomainLabelListCacheDuration().getMillis(),
MILLISECONDS)
.build(new CacheLoader<String, PremiumList>() {
@Override
public PremiumList load(final String listName) {
return ofy().doTransactionless(new Work<PremiumList>() {
private static LoadingCache<String, PremiumList> cache =
CacheBuilder.newBuilder()
.expireAfterWrite(getDomainLabelListCacheDuration().getMillis(), MILLISECONDS)
.build(new CacheLoader<String, PremiumList>() {
@Override
public PremiumList run() {
return ofy().load()
.type(PremiumList.class)
.parent(getCrossTldKey())
.id(listName)
.now();
public PremiumList load(final String listName) {
return ofy().doTransactionless(new Work<PremiumList>() {
@Override
public PremiumList run() {
return ofy().load()
.type(PremiumList.class)
.parent(getCrossTldKey())
.id(listName)
.now();
}});
}});
}});
/**
* Gets the premium price for the specified label on the specified tld, or returns Optional.absent

View file

@ -16,6 +16,7 @@ package google.registry.model.registry.label;
import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkNotNull;
import static google.registry.config.RegistryConfig.getDomainLabelListCacheDuration;
import static google.registry.model.common.EntityGroupRoot.getCrossTldKey;
import static google.registry.model.ofy.ObjectifyService.ofy;
import static google.registry.model.ofy.Ofy.RECOMMENDED_MEMCACHE_EXPIRATION;
@ -40,7 +41,6 @@ import com.googlecode.objectify.annotation.Embed;
import com.googlecode.objectify.annotation.Entity;
import com.googlecode.objectify.annotation.Mapify;
import com.googlecode.objectify.mapper.Mapper;
import google.registry.config.RegistryEnvironment;
import google.registry.model.registry.Registry;
import java.util.List;
import java.util.Map;
@ -221,16 +221,20 @@ public final class ReservedList
return builder.build();
}
private static LoadingCache<String, ReservedList> cache = CacheBuilder
.newBuilder()
.expireAfterWrite(
RegistryEnvironment.get().config().getDomainLabelListCacheDuration().getMillis(),
MILLISECONDS)
.build(new CacheLoader<String, ReservedList>() {
@Override
public ReservedList load(String listName) {
return ofy().load().type(ReservedList.class).parent(getCrossTldKey()).id(listName).now();
}});
private static LoadingCache<String, ReservedList> cache =
CacheBuilder.newBuilder()
.expireAfterWrite(getDomainLabelListCacheDuration().getMillis(), MILLISECONDS)
.build(
new CacheLoader<String, ReservedList>() {
@Override
public ReservedList load(String listName) {
return ofy()
.load()
.type(ReservedList.class)
.parent(getCrossTldKey())
.id(listName)
.now();
}});
/**
* Gets the {@link ReservationType} of a label in a single ReservedList, or returns an absent