ChangeRequestHttpSyncer: Don't wait 1ms when checking isInitialized(). (#14547)

The wait doesn't seem to serve a purpose, other than causing delays
when checking isInitialized() for a large number of things that have
not yet been initialized.
This commit is contained in:
Gian Merlino 2023-07-07 05:54:39 -07:00 committed by GitHub
parent d63eff3b1b
commit 1fe61bc869
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 16 deletions

View File

@ -346,13 +346,7 @@ public class WorkerHolder
public boolean isInitialized()
{
try {
return syncer.isInitialized();
}
catch (InterruptedException ignored) {
Thread.currentThread().interrupt();
return false;
}
return syncer.isInitialized();
}
public boolean isEnabled()

View File

@ -571,12 +571,7 @@ public class HttpServerInventoryView implements ServerInventoryView, FilteredSer
boolean isSyncedSuccessfullyAtleastOnce()
{
try {
return syncer.isInitialized();
}
catch (InterruptedException ex) {
throw new ISE(ex, "Interrupted while waiting for first sync with server[%s].", druidServer.getName());
}
return syncer.isInitialized();
}
private ChangeRequestHttpSyncer.Listener<DataSegmentChangeRequest> createSyncListener()

View File

@ -172,11 +172,11 @@ public class ChangeRequestHttpSyncer<T>
}
/**
* Waits upto 1 millisecond for the first successful sync with this server.
* Whether this server has been synced successfully at least once.
*/
public boolean isInitialized() throws InterruptedException
public boolean isInitialized()
{
return initializationLatch.await(1, TimeUnit.MILLISECONDS);
return initializationLatch.getCount() == 0;
}
/**