@@ -44,8 +44,8 @@ public class AnalyticsClient {
4444 private static final Charset ENCODING = StandardCharsets .UTF_8 ;
4545 private Gson gsonInstance ;
4646 private static final String instanceId = UUID .randomUUID ().toString ();
47- private static final int WAIT_FOR_THREAD_COMPLETE_MS = 5000 ;
48- private static final int TERMINATION_TIMEOUT_MS = 1000 ;
47+ private static final int WAIT_FOR_THREAD_COMPLETE_S = 5 ;
48+ private static final int TERMINATION_TIMEOUT_S = 1 ;
4949
5050 static {
5151 Map <String , String > library = new LinkedHashMap <>();
@@ -245,7 +245,7 @@ private void waitForLooperCompletion() {
245245 try {
246246 // Wait for the looper to complete processing the STOP message and finish
247247 // Use a reasonable timeout to avoid hanging indefinitely
248- looperFuture .get (WAIT_FOR_THREAD_COMPLETE_MS , TimeUnit .MILLISECONDS );
248+ looperFuture .get (WAIT_FOR_THREAD_COMPLETE_S , TimeUnit .SECONDS );
249249 log .print (VERBOSE , "Looper completed successfully." );
250250 } catch (Exception e ) {
251251 log .print (ERROR , e , "Error waiting for looper to complete." );
@@ -262,14 +262,14 @@ public void shutdownAndWait(ExecutorService executor, String name) {
262262 boolean isLooperExecutor = name != null && name .equalsIgnoreCase ("looper" );
263263 try {
264264 executor .shutdown ();
265- boolean terminated = executor .awaitTermination (TERMINATION_TIMEOUT_MS , TimeUnit .MILLISECONDS );
265+ boolean terminated = executor .awaitTermination (TERMINATION_TIMEOUT_S , TimeUnit .SECONDS );
266266 if (terminated ) {
267267 log .print (VERBOSE , "%s executor terminated normally." , name );
268268 return ;
269269 }
270270 if (isLooperExecutor ) { // Handle looper - network could be passed in and should finish on its own
271271 // not terminated within timeout -> force shutdown
272- log .print (VERBOSE , "%s did not terminate in %d ms ; requesting shutdownNow()." , name , TERMINATION_TIMEOUT_MS );
272+ log .print (VERBOSE , "%s did not terminate in %d seconds ; requesting shutdownNow()." , name , TERMINATION_TIMEOUT_S );
273273 List <Runnable > dropped = executor .shutdownNow (); // interrupts running tasks
274274 log .print (
275275 VERBOSE ,
@@ -278,7 +278,7 @@ public void shutdownAndWait(ExecutorService executor, String name) {
278278 dropped .size ());
279279
280280 // optional short wait to give interrupted tasks a chance to exit
281- boolean terminatedAfterForce = executor .awaitTermination (TERMINATION_TIMEOUT_MS , TimeUnit .MILLISECONDS );
281+ boolean terminatedAfterForce = executor .awaitTermination (TERMINATION_TIMEOUT_S , TimeUnit .SECONDS );
282282 log .print (
283283 VERBOSE ,
284284 "%s executor %s after shutdownNow()." ,
0 commit comments