Skip to content

Commit f1da118

Browse files
Merge 395b563 into fa4adcf
2 parents fa4adcf + 395b563 commit f1da118

File tree

2 files changed

+12
-25
lines changed

2 files changed

+12
-25
lines changed

firebase-perf/src/main/java/com/google/firebase/perf/metrics/AppStartTrace.java

Lines changed: 11 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@ public class AppStartTrace implements ActivityLifecycleCallbacks {
6868
private static final int CORE_POOL_SIZE = 0;
6969
private static final int MAX_POOL_SIZE = 1; // Only need single thread
7070

71-
private static volatile AppStartTrace instance;
7271
private static ExecutorService executorService;
7372

7473
private boolean isRegisteredForLifecycleCallbacks = false;
@@ -129,29 +128,17 @@ public static void setLauncherActivityOnResumeTime(String activity) {
129128
// no-op, for backward compatibility with old version plugin.
130129
}
131130

132-
public static AppStartTrace getInstance() {
133-
return instance != null ? instance : getInstance(TransportManager.getInstance(), new Clock());
134-
}
135-
136-
static AppStartTrace getInstance(TransportManager transportManager, Clock clock) {
137-
if (instance == null) {
138-
synchronized (AppStartTrace.class) {
139-
if (instance == null) {
140-
instance =
141-
new AppStartTrace(
142-
transportManager,
143-
clock,
144-
ConfigResolver.getInstance(),
145-
new ThreadPoolExecutor(
146-
CORE_POOL_SIZE,
147-
MAX_POOL_SIZE,
148-
/* keepAliveTime= */ MAX_LATENCY_BEFORE_UI_INIT + 10,
149-
TimeUnit.SECONDS,
150-
new LinkedBlockingQueue<>()));
151-
}
152-
}
153-
}
154-
return instance;
131+
public AppStartTrace() {
132+
this(
133+
TransportManager.getInstance(),
134+
new Clock(),
135+
ConfigResolver.getInstance(),
136+
new ThreadPoolExecutor(
137+
CORE_POOL_SIZE,
138+
MAX_POOL_SIZE,
139+
/* keepAliveTime= */ MAX_LATENCY_BEFORE_UI_INIT + 10,
140+
TimeUnit.SECONDS,
141+
new LinkedBlockingQueue<>()));
155142
}
156143

157144
AppStartTrace(

firebase-perf/src/main/java/com/google/firebase/perf/provider/FirebasePerfProvider.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ public void attachInfo(Context context, ProviderInfo info) {
6666
appStateMonitor.registerActivityLifecycleCallbacks(getContext());
6767
appStateMonitor.registerForAppColdStart(new FirebasePerformanceInitializer());
6868

69-
AppStartTrace appStartTrace = AppStartTrace.getInstance();
69+
AppStartTrace appStartTrace = new AppStartTrace();
7070
appStartTrace.registerActivityLifecycleCallbacks(getContext());
7171

7272
mainHandler.post(new AppStartTrace.StartFromBackgroundRunnable(appStartTrace));

0 commit comments

Comments
 (0)