Skip to content

Commit a5d7969

Browse files
committed
Use Firebase executors for realtime.
1 parent de78e70 commit a5d7969

File tree

5 files changed

+14
-10
lines changed

5 files changed

+14
-10
lines changed

firebase-config/ktx/src/test/kotlin/com/google/firebase/remoteconfig/TestConstructorUtil.kt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ fun createRemoteConfig(
3838
defaultConfigsCache: ConfigCacheClient,
3939
fetchHandler: ConfigFetchHandler,
4040
getHandler: ConfigGetParameterHandler,
41-
frcMetadata: ConfigMetadataClient
41+
frcMetadata: ConfigMetadataClient,
42+
realtimeHandler: ConfigRealtimeHandler
4243
): FirebaseRemoteConfig {
4344
return FirebaseRemoteConfig(
4445
context,
@@ -51,6 +52,7 @@ fun createRemoteConfig(
5152
defaultConfigsCache,
5253
fetchHandler,
5354
getHandler,
54-
frcMetadata
55+
frcMetadata,
56+
realtimeHandler
5557
)
5658
}

firebase-config/ktx/src/test/kotlin/com/google/firebase/remoteconfig/ktx/RemoteConfigTests.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,8 @@ class ConfigTests : BaseTestCase() {
139139
defaultConfigsCache = mock(ConfigCacheClient::class.java),
140140
fetchHandler = mock(ConfigFetchHandler::class.java),
141141
getHandler = mockGetHandler,
142-
frcMetadata = mock(ConfigMetadataClient::class.java)
142+
frcMetadata = mock(ConfigMetadataClient::class.java),
143+
realtimeHandler = mock(ConfigRealtimeHandler::class.java)
143144
)
144145

145146
`when`(mockGetHandler.getValue("KEY")).thenReturn(StringRemoteConfigValue("non default value"))

firebase-config/src/main/java/com/google/firebase/remoteconfig/RemoteConfigComponent.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@
4343
import java.util.Map;
4444
import java.util.Random;
4545
import java.util.concurrent.Executor;
46+
import java.util.concurrent.ScheduledExecutorService;
47+
import java.util.concurrent.atomic.AtomicReference;
4648

4749
/**
4850
* Component for providing multiple Firebase Remote Config (FRC) instances. Firebase Android
@@ -82,7 +84,7 @@ public class RemoteConfigComponent {
8284
new HashMap<>();
8385

8486
private final Context context;
85-
private final Executor executor;
87+
private final ScheduledExecutorService executor;
8688
private final FirebaseApp firebaseApp;
8789
private final FirebaseInstallationsApi firebaseInstallations;
8890
private final FirebaseABTesting firebaseAbt;
@@ -96,7 +98,7 @@ public class RemoteConfigComponent {
9698
/** Firebase Remote Config Component constructor. */
9799
RemoteConfigComponent(
98100
Context context,
99-
@Blocking Executor executor,
101+
@Blocking ScheduledExecutorService executor,
100102
FirebaseApp firebaseApp,
101103
FirebaseInstallationsApi firebaseInstallations,
102104
FirebaseABTesting firebaseAbt,
@@ -115,7 +117,7 @@ public class RemoteConfigComponent {
115117
@VisibleForTesting
116118
protected RemoteConfigComponent(
117119
Context context,
118-
Executor executor,
120+
ScheduledExecutorService executor,
119121
FirebaseApp firebaseApp,
120122
FirebaseInstallationsApi firebaseInstallations,
121123
FirebaseABTesting firebaseAbt,
@@ -279,7 +281,7 @@ synchronized ConfigRealtimeHandler getRealtime(
279281
activatedCacheClient,
280282
context,
281283
namespace,
282-
scheduledExecutorService);
284+
executor);
283285
}
284286

285287
private ConfigGetParameterHandler getGetHandler(

firebase-config/src/main/java/com/google/firebase/remoteconfig/RemoteConfigRegistrar.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
import java.util.Arrays;
3131
import java.util.List;
3232
import java.util.concurrent.Executor;
33+
import java.util.concurrent.ScheduledExecutorService;
3334

3435
/**
3536
* Registrar for setting up Firebase Remote Config's dependency injections in Firebase Android
@@ -44,7 +45,7 @@ public class RemoteConfigRegistrar implements ComponentRegistrar {
4445

4546
@Override
4647
public List<Component<?>> getComponents() {
47-
Qualified<Executor> blockingExecutor = Qualified.qualified(Blocking.class, Executor.class);
48+
Qualified<ScheduledExecutorService> blockingExecutor = Qualified.qualified(Blocking.class, ScheduledExecutorService.class);
4849
return Arrays.asList(
4950
Component.builder(RemoteConfigComponent.class)
5051
.name(LIBRARY_NAME)

firebase-config/src/test/java/com/google/firebase/remoteconfig/RemoteConfigComponentTest.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,6 @@ public void getFetchHandler_nonMainFirebaseApp_doesNotUseAnalytics() {
175175
private RemoteConfigComponent getNewFrcComponent() {
176176
return new RemoteConfigComponent(
177177
context,
178-
directExecutor,
179178
scheduledExecutorService,
180179
mockFirebaseApp,
181180
mockFirebaseInstallations,
@@ -187,7 +186,6 @@ private RemoteConfigComponent getNewFrcComponent() {
187186
private RemoteConfigComponent getNewFrcComponentWithoutLoadingDefault() {
188187
return new RemoteConfigComponent(
189188
context,
190-
directExecutor,
191189
scheduledExecutorService,
192190
mockFirebaseApp,
193191
mockFirebaseInstallations,

0 commit comments

Comments
 (0)