Class ChangeRequestHttpSyncer<T>
java.lang.Object
org.apache.druid.server.coordination.ChangeRequestHttpSyncer<T>
This class facilitates the usage of long-polling HTTP endpoints powered by
ChangeRequestHistory.
For example HttpServerInventoryView uses it to keep segment state in sync with data
nodes which expose the segment state via HTTP endpoint in SegmentListerResource.getSegments(long, long, long, javax.servlet.http.HttpServletRequest).-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceConcurrency guarantees: all calls toChangeRequestHttpSyncer.Listener.fullSync(java.util.List<T>)andChangeRequestHttpSyncer.Listener.deltaSync(java.util.List<T>)(that is done within theexecutor) are linearizable. -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionChangeRequestHttpSyncer(com.fasterxml.jackson.databind.ObjectMapper smileMapper, HttpClient httpClient, ScheduledExecutorService executor, URL baseServerURL, String baseRequestPath, com.fasterxml.jackson.core.type.TypeReference<ChangeRequestsSnapshot<T>> responseTypeReferences, long serverTimeoutMS, long serverUnstabilityTimeout, ChangeRequestHttpSyncer.Listener<T> listener) -
Method Summary
Modifier and TypeMethodDescriptionbooleanWaits for the first successful sync with this server up tomaxDurationToWaitForSync.Returns debugging information for printing, must not be used for any other purpose.longbooleanbooleanWhether this server has been synced successfully at least once.booleanbooleanWhether this syncer should be reset.voidstart()voidstop()
-
Field Details
-
HTTP_TIMEOUT_EXTRA_MS
public static final long HTTP_TIMEOUT_EXTRA_MS- See Also:
-
-
Constructor Details
-
ChangeRequestHttpSyncer
public ChangeRequestHttpSyncer(com.fasterxml.jackson.databind.ObjectMapper smileMapper, HttpClient httpClient, ScheduledExecutorService executor, URL baseServerURL, String baseRequestPath, com.fasterxml.jackson.core.type.TypeReference<ChangeRequestsSnapshot<T>> responseTypeReferences, long serverTimeoutMS, long serverUnstabilityTimeout, ChangeRequestHttpSyncer.Listener<T> listener)
-
-
Method Details
-
start
public void start() -
stop
public void stop() -
awaitInitialization
Waits for the first successful sync with this server up tomaxDurationToWaitForSync.- Throws:
InterruptedException
-
isInitialized
public boolean isInitialized()Whether this server has been synced successfully at least once. -
getDebugInfo
Returns debugging information for printing, must not be used for any other purpose. -
needsReset
public boolean needsReset()Whether this syncer should be reset. This method returning true typically indicates a problem with the sync scheduler.- Returns:
- true if the delay since the last request to the server (or since
syncer start in case of no request to the server) has exceeded
maxDelayBetweenSyncRequests.
-
getUnstableTimeMillis
public long getUnstableTimeMillis() -
isSyncedSuccessfully
public boolean isSyncedSuccessfully()- Returns:
- true if there have been no sync failures recently and the last
successful sync was not more than
maxDurationToWaitForSyncago.
-
isExecutorShutdown
public boolean isExecutorShutdown()
-