mirror of
https://github.com/google/nomulus.git
synced 2025-05-12 22:38:16 +02:00
Use standard java thread factory instead of the AppEngine flavor
With Java 8 in GAE standard environment, we can now use standard java thread factory to run the metric reporter in the background in daemon mode, which would not interfere with basic scaling idle timeout as App Engine thread would. Because the thread is not created by ThreadManager, no App Engine APIs can be called from it. We therefore use GoogleCredential instead of AppIdentityCredential as HttpRequestInitializer, and NetHttpTransport instead of UlrFetchTransport as HttpTransport. MetricReporter is lazy injected because it depends on jsonCredential retrieved from CloudKms, which is not available in a test environment, causing FrontendServletTest and BackendServletTest to fail. Some minor re-formatting with google-java-format on edited files. Lastly removed moe comments in import statement, which makes the linter unhappy. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=172896227
This commit is contained in:
parent
b01fa6b4c9
commit
c702b4486c
8 changed files with 151 additions and 118 deletions
|
@ -15,9 +15,9 @@
|
|||
package google.registry.module.backend;
|
||||
|
||||
import dagger.Component;
|
||||
import dagger.Lazy;
|
||||
import google.registry.bigquery.BigqueryModule;
|
||||
import google.registry.config.RegistryConfig.ConfigModule;
|
||||
import google.registry.dns.writer.VoidDnsWriterModule;
|
||||
import google.registry.export.DriveModule;
|
||||
import google.registry.export.sheet.SheetsServiceModule;
|
||||
import google.registry.gcs.GcsServiceModule;
|
||||
|
@ -36,6 +36,7 @@ import google.registry.request.Modules.DatastoreServiceModule;
|
|||
import google.registry.request.Modules.GoogleCredentialModule;
|
||||
import google.registry.request.Modules.Jackson2Module;
|
||||
import google.registry.request.Modules.ModulesServiceModule;
|
||||
import google.registry.request.Modules.NetHttpTransportModule;
|
||||
import google.registry.request.Modules.URLFetchServiceModule;
|
||||
import google.registry.request.Modules.UrlFetchTransportModule;
|
||||
import google.registry.request.Modules.UseAppIdentityCredentialForGoogleApisModule;
|
||||
|
@ -48,36 +49,39 @@ import javax.inject.Singleton;
|
|||
/** Dagger component with instance lifetime for "backend" App Engine module. */
|
||||
@Singleton
|
||||
@Component(
|
||||
modules = {
|
||||
AppIdentityCredentialModule.class,
|
||||
AuthModule.class,
|
||||
BackendRequestComponentModule.class,
|
||||
BigqueryModule.class,
|
||||
ConfigModule.class,
|
||||
DatastoreServiceModule.class,
|
||||
DirectoryModule.class,
|
||||
DriveModule.class,
|
||||
GcsServiceModule.class,
|
||||
GoogleCredentialModule.class,
|
||||
GroupsModule.class,
|
||||
GroupssettingsModule.class,
|
||||
JSchModule.class,
|
||||
Jackson2Module.class,
|
||||
KeyModule.class,
|
||||
KeyringModule.class,
|
||||
KmsModule.class,
|
||||
ModulesServiceModule.class,
|
||||
SheetsServiceModule.class,
|
||||
StackdriverModule.class,
|
||||
SystemClockModule.class,
|
||||
SystemSleeperModule.class,
|
||||
URLFetchServiceModule.class,
|
||||
UrlFetchTransportModule.class,
|
||||
UseAppIdentityCredentialForGoogleApisModule.class,
|
||||
UserServiceModule.class,
|
||||
VoidDnsWriterModule.class,
|
||||
})
|
||||
modules = {
|
||||
AppIdentityCredentialModule.class,
|
||||
AuthModule.class,
|
||||
BackendRequestComponentModule.class,
|
||||
BigqueryModule.class,
|
||||
ConfigModule.class,
|
||||
DatastoreServiceModule.class,
|
||||
DirectoryModule.class,
|
||||
DriveModule.class,
|
||||
GcsServiceModule.class,
|
||||
GoogleCredentialModule.class,
|
||||
GroupsModule.class,
|
||||
GroupssettingsModule.class,
|
||||
JSchModule.class,
|
||||
Jackson2Module.class,
|
||||
KeyModule.class,
|
||||
KeyringModule.class,
|
||||
KmsModule.class,
|
||||
ModulesServiceModule.class,
|
||||
NetHttpTransportModule.class,
|
||||
SheetsServiceModule.class,
|
||||
StackdriverModule.class,
|
||||
SystemClockModule.class,
|
||||
SystemSleeperModule.class,
|
||||
URLFetchServiceModule.class,
|
||||
UrlFetchTransportModule.class,
|
||||
UseAppIdentityCredentialForGoogleApisModule.class,
|
||||
UserServiceModule.class,
|
||||
google.registry.dns.writer.VoidDnsWriterModule.class,
|
||||
}
|
||||
)
|
||||
interface BackendComponent {
|
||||
BackendRequestHandler requestHandler();
|
||||
MetricReporter metricReporter();
|
||||
|
||||
Lazy<MetricReporter> metricReporter();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue