Class LuceneConcurrency
java.lang.Object
com.apple.foundationdb.record.lucene.LuceneConcurrency
Utility class for methods related to synchronizing Futures.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
An exception that is thrown when the async to sync operation times out. -
Method Summary
Modifier and TypeMethodDescriptionstatic <T> T
asyncToSync
(StoreTimer.Wait event, CompletableFuture<T> async, FDBRecordContext recordContext) An implementation ofasyncToSync
that is isolated from external exception injections.
-
Method Details
-
asyncToSync
@Nullable @API(INTERNAL) public static <T> T asyncToSync(@Nonnull StoreTimer.Wait event, @Nonnull CompletableFuture<T> async, @Nonnull FDBRecordContext recordContext) An implementation ofasyncToSync
that is isolated from external exception injections. This implementation does NOT perform exception mapping (as the originalFDBRecordContext.asyncToSync(com.apple.foundationdb.record.provider.common.StoreTimer.Wait, java.util.concurrent.CompletableFuture<T>)
does). This method is meant to be used internally in places where obtaining and using the result of asynchronous operation is required. This method uses theFDBDatabase.getAsyncToSyncTimeout(com.apple.foundationdb.record.provider.common.StoreTimer.Wait)
to find the period to use for the timeout. This method will throw the runtime exception that was thrown by the Future's realization in case such error occurred. This method will use the legacyFDBRecordContext.asyncToSync(com.apple.foundationdb.record.provider.common.StoreTimer.Wait, java.util.concurrent.CompletableFuture<T>)
if the LUCENE_USE_LEGACY_ASYNC_TO_SYNC property is set to TRUE (the default)- Parameters:
event
- the timer event to use for recording the waitsasync
- the future to wait onrecordContext
- the context to use for callback, recording the event and getting the timeout- Returns:
- the result of the future's operation
-