@@ -59,8 +59,9 @@ public class GaugeManager {
5959 private final TransportManager transportManager ;
6060
6161 @ Nullable private GaugeMetadataManager gaugeMetadataManager ;
62- @ Nullable private ScheduledFuture gaugeManagerDataCollectionJob = null ;
62+ @ Nullable private ScheduledFuture <?> gaugeManagerDataCollectionJob = null ;
6363 @ Nullable private String sessionId = null ;
64+ @ Nullable private String aqsSessionId = null ;
6465 private ApplicationProcessState applicationProcessState =
6566 ApplicationProcessState .APPLICATION_PROCESS_STATE_UNKNOWN ;
6667
@@ -130,10 +131,11 @@ public void startCollectingGauges(
130131 }
131132
132133 this .sessionId = session .sessionId ();
134+ this .aqsSessionId = session .aqsSessionId ();
133135 this .applicationProcessState = applicationProcessState ;
134136
135137 // This is needed, otherwise the Runnable might use a stale value.
136- final String sessionIdForScheduledTask = sessionId ;
138+ final String sessionIdForScheduledTask = aqsSessionId ;
137139 final ApplicationProcessState applicationProcessStateForScheduledTask = applicationProcessState ;
138140
139141 // TODO(b/394127311): Switch to using AQS.
@@ -195,7 +197,7 @@ public void stopCollectingGauges() {
195197 }
196198
197199 // This is needed, otherwise the Runnable might use a stale value.
198- final String sessionIdForScheduledTask = sessionId ;
200+ final String sessionIdForScheduledTask = aqsSessionId ;
199201 final ApplicationProcessState applicationProcessStateForScheduledTask = applicationProcessState ;
200202
201203 cpuGaugeCollector .get ().stopCollecting ();
@@ -205,10 +207,9 @@ public void stopCollectingGauges() {
205207 gaugeManagerDataCollectionJob .cancel (false );
206208 }
207209
208- // TODO(b/394127311): Switch to using AQS.
209210 // Flush any data that was collected for this session one last time.
210211 @ SuppressWarnings ("FutureReturnValueIgnored" )
211- ScheduledFuture unusedFuture =
212+ ScheduledFuture <?> unusedFuture =
212213 gaugeManagerExecutor
213214 .get ()
214215 .schedule (
0 commit comments