@Test public void testBlockingInAsyncException() { FDBDatabaseFactory factory = FDBDatabaseFactory.instance(); factory.setBlockingInAsyncDetection(BlockingInAsyncDetection.IGNORE_COMPLETE_EXCEPTION_BLOCKING); factory.clear(); FDBDatabase database = factory.getDatabase(); assertEquals(BlockingInAsyncDetection.IGNORE_COMPLETE_EXCEPTION_BLOCKING, database.getBlockingInAsyncDetection()); assertThrows(BlockingInAsyncException.class, () -> callAsyncBlocking(database)); }
@API(API.Status.INTERNAL) public BlockingInAsyncDetection getBlockingInAsyncDetection() { return blockingInAsyncDetectionSupplier.get(); }
FDBDatabase { @API(API.Status.INTERNAL) public BlockingInAsyncDetection getBlockingInAsyncDetection() { return blockingInAsyncDetectionSupplier.get(); } }
FDBDatabase { @API(API.Status.INTERNAL) public BlockingInAsyncDetection getBlockingInAsyncDetection() { return blockingInAsyncDetectionSupplier.get(); } @VisibleForTesting  FDBDatabase(@Nonnull FDBDatabaseFactory factory, @Nullable String clusterFile); }
FDBDatabase { @API(API.Status.INTERNAL) public BlockingInAsyncDetection getBlockingInAsyncDetection() { return blockingInAsyncDetectionSupplier.get(); } @VisibleForTesting  FDBDatabase(@Nonnull FDBDatabaseFactory factory, @Nullable String clusterFile); synchronized void setDirectoryCacheSize(int size); synchronized void setDatacenterId(String datacenterId); synchronized String getDatacenterId(); @Nonnull synchronized FDBLocalityProvider getLocalityProvider(); synchronized void setTrackLastSeenVersionOnRead(boolean trackLastSeenVersion); synchronized boolean isTrackLastSeenVersionOnRead(); synchronized void setTrackLastSeenVersionOnCommit(boolean trackLastSeenVersion); synchronized boolean isTrackLastSeenVersionOnCommit(); synchronized void setTrackLastSeenVersion(boolean trackLastSeenVersion); synchronized boolean isTrackLastSeenVersion(); @Nullable String getClusterFile(); @Nonnull Database database(); @Nonnull FDBRecordContext openContext(); @Nonnull FDBRecordContext openContext(@Nullable Map<String, String> mdcContext,
                                        @Nullable FDBStoreTimer timer); @Nonnull FDBRecordContext openContext(@Nullable Map<String, String> mdcContext,
                                        @Nullable FDBStoreTimer timer,
                                        @Nullable WeakReadSemantics weakReadSemantics); @Nonnull FDBRecordContext openContext(@Nullable Map<String, String> mdcContext,
                                        @Nullable FDBStoreTimer timer,
                                        @Nullable WeakReadSemantics weakReadSemantics,
                                        @Nonnull FDBTransactionPriority priority); @Nonnull FDBRecordContext openContext(@Nullable Map<String, String> mdcContext,
                                        @Nullable FDBStoreTimer timer,
                                        @Nullable WeakReadSemantics weakReadSemantics,
                                        @Nonnull FDBTransactionPriority priority,
                                        @Nullable String transactionId); @Nonnull @SuppressWarnings("PMD.CompareObjectsWithEquals") FDBRecordContext openContext(@Nonnull FDBRecordContextConfig contextConfig); @Nonnull CompletableFuture<Void> performNoOpAsync(); @Nonnull CompletableFuture<Void> performNoOpAsync(@Nullable FDBStoreTimer timer); @Nonnull CompletableFuture<Void> performNoOpAsync(@Nullable Map<String, String> mdcContext,
                                                    @Nullable FDBStoreTimer timer); void performNoOp(); void performNoOp(@Nullable FDBStoreTimer timer); void performNoOp(@Nullable Map<String, String> mdcContext, @Nullable FDBStoreTimer timer); long getResolverStateCacheRefreshTime(); @VisibleForTesting void setResolverStateRefreshTimeMillis(long resolverStateRefreshTimeMillis); @Nonnull @API(API.Status.INTERNAL) CompletableFuture<ResolverStateProto.State> getStateForResolver(@Nonnull LocatableResolver resolver,
                                                                           @Nonnull Supplier<CompletableFuture<ResolverStateProto.State>> loader); @Deprecated @Nonnull CompletableFuture<Long> getReadVersion(@Nonnull FDBRecordContext context); @API(API.Status.INTERNAL) void updateLastSeenFDBVersion(long startTime, long readVersion); @Nonnull @API(API.Status.INTERNAL) FDBReverseDirectoryCache getReverseDirectoryCache(); @API(API.Status.INTERNAL) int getDirectoryCacheVersion(); CacheStats getDirectoryCacheStats(); @Nonnull @API(API.Status.INTERNAL) Cache<ScopedValue<String>, ResolverResult> getDirectoryCache(int atVersion); @Nonnull @API(API.Status.INTERNAL) Cache<ScopedValue<Long>, String> getReverseDirectoryInMemoryCache(); @API(API.Status.INTERNAL) void clearForwardDirectoryCache(); @VisibleForTesting @API(API.Status.INTERNAL) void clearReverseDirectoryCache(); @Nonnull FDBRecordStoreStateCache getStoreStateCache(); void setStoreStateCache(@Nonnull FDBRecordStoreStateCache storeStateCache); @VisibleForTesting @API(API.Status.INTERNAL) void clearCaches(); synchronized void close(); @Nonnull Executor getExecutor(); @Deprecated @API(API.Status.DEPRECATED) Transaction createTransaction(Executor executor, @Nullable Map<String, String> mdcContext, boolean transactionIsTraced); @Nonnull FDBDatabaseRunner newRunner(@Nonnull FDBRecordContextConfig.Builder contextConfigBuilder); @Nonnull FDBDatabaseRunner newRunner(); @Nonnull FDBDatabaseRunner newRunner(@Nullable FDBStoreTimer timer, @Nullable Map<String, String> mdcContext); @Nonnull FDBDatabaseRunner newRunner(@Nullable FDBStoreTimer timer, @Nullable Map<String, String> mdcContext,
                                       @Nullable WeakReadSemantics weakReadSemantics); T run(@Nonnull Function<? super FDBRecordContext, ? extends T> retriable); T run(@Nullable FDBStoreTimer timer, @Nullable Map<String, String> mdcContext,
                     @Nonnull Function<? super FDBRecordContext, ? extends T> retriable); T run(@Nullable FDBStoreTimer timer, @Nullable Map<String, String> mdcContext, @Nullable WeakReadSemantics weakReadSemantics,
                     @Nonnull Function<? super FDBRecordContext, ? extends T> retriable); @Nonnull @API(API.Status.MAINTAINED) CompletableFuture<T> runAsync(@Nonnull Function<? super FDBRecordContext, CompletableFuture<? extends T>> retriable); @Nonnull @API(API.Status.MAINTAINED) CompletableFuture<T> runAsync(@Nullable FDBStoreTimer timer, @Nullable Map<String, String> mdcContext,
                                             @Nonnull Function<? super FDBRecordContext, CompletableFuture<? extends T>> retriable); @Nonnull @API(API.Status.MAINTAINED) CompletableFuture<T> runAsync(@Nullable FDBStoreTimer timer, @Nullable Map<String, String> mdcContext, @Nullable WeakReadSemantics weakReadSemantics,
                                             @Nonnull Function<? super FDBRecordContext, CompletableFuture<? extends T>> retriable); boolean hasAsyncToSyncTimeout(); @Nullable Pair<Long, TimeUnit> getAsyncToSyncTimeout(FDBStoreTimer.Wait event); @Nullable Function<FDBStoreTimer.Wait, Pair<Long, TimeUnit>> getAsyncToSyncTimeout(); void setAsyncToSyncTimeout(@Nullable Function<FDBStoreTimer.Wait, Pair<Long, TimeUnit>> asyncToSyncTimeout); void setAsyncToSyncTimeout(long asyncToSyncTimeout, @Nonnull TimeUnit asyncToSyncTimeoutUnit); void clearAsyncToSyncTimeout(); void setAsyncToSyncExceptionMapper(@Nonnull ExceptionMapper asyncToSyncExceptionMapper); @Nullable T asyncToSync(@Nullable FDBStoreTimer timer, FDBStoreTimer.Wait event, @Nonnull CompletableFuture<T> async); T join(CompletableFuture<T> future); T joinNow(CompletableFuture<T> future); T get(CompletableFuture<T> future); @VisibleForTesting int warnAndCloseOldTrackedOpenContexts(long minAgeSeconds); @API(API.Status.INTERNAL) BlockingInAsyncDetection getBlockingInAsyncDetection(); CompletableFuture<Tuple> loadBoundaryKeys(@Nonnull FDBTransactionContext context, Tuple key); }
FDBDatabase { @API(API.Status.INTERNAL) public BlockingInAsyncDetection getBlockingInAsyncDetection() { return blockingInAsyncDetectionSupplier.get(); } @VisibleForTesting  FDBDatabase(@Nonnull FDBDatabaseFactory factory, @Nullable String clusterFile); synchronized void setDirectoryCacheSize(int size); synchronized void setDatacenterId(String datacenterId); synchronized String getDatacenterId(); @Nonnull synchronized FDBLocalityProvider getLocalityProvider(); synchronized void setTrackLastSeenVersionOnRead(boolean trackLastSeenVersion); synchronized boolean isTrackLastSeenVersionOnRead(); synchronized void setTrackLastSeenVersionOnCommit(boolean trackLastSeenVersion); synchronized boolean isTrackLastSeenVersionOnCommit(); synchronized void setTrackLastSeenVersion(boolean trackLastSeenVersion); synchronized boolean isTrackLastSeenVersion(); @Nullable String getClusterFile(); @Nonnull Database database(); @Nonnull FDBRecordContext openContext(); @Nonnull FDBRecordContext openContext(@Nullable Map<String, String> mdcContext,
                                        @Nullable FDBStoreTimer timer); @Nonnull FDBRecordContext openContext(@Nullable Map<String, String> mdcContext,
                                        @Nullable FDBStoreTimer timer,
                                        @Nullable WeakReadSemantics weakReadSemantics); @Nonnull FDBRecordContext openContext(@Nullable Map<String, String> mdcContext,
                                        @Nullable FDBStoreTimer timer,
                                        @Nullable WeakReadSemantics weakReadSemantics,
                                        @Nonnull FDBTransactionPriority priority); @Nonnull FDBRecordContext openContext(@Nullable Map<String, String> mdcContext,
                                        @Nullable FDBStoreTimer timer,
                                        @Nullable WeakReadSemantics weakReadSemantics,
                                        @Nonnull FDBTransactionPriority priority,
                                        @Nullable String transactionId); @Nonnull @SuppressWarnings("PMD.CompareObjectsWithEquals") FDBRecordContext openContext(@Nonnull FDBRecordContextConfig contextConfig); @Nonnull CompletableFuture<Void> performNoOpAsync(); @Nonnull CompletableFuture<Void> performNoOpAsync(@Nullable FDBStoreTimer timer); @Nonnull CompletableFuture<Void> performNoOpAsync(@Nullable Map<String, String> mdcContext,
                                                    @Nullable FDBStoreTimer timer); void performNoOp(); void performNoOp(@Nullable FDBStoreTimer timer); void performNoOp(@Nullable Map<String, String> mdcContext, @Nullable FDBStoreTimer timer); long getResolverStateCacheRefreshTime(); @VisibleForTesting void setResolverStateRefreshTimeMillis(long resolverStateRefreshTimeMillis); @Nonnull @API(API.Status.INTERNAL) CompletableFuture<ResolverStateProto.State> getStateForResolver(@Nonnull LocatableResolver resolver,
                                                                           @Nonnull Supplier<CompletableFuture<ResolverStateProto.State>> loader); @Deprecated @Nonnull CompletableFuture<Long> getReadVersion(@Nonnull FDBRecordContext context); @API(API.Status.INTERNAL) void updateLastSeenFDBVersion(long startTime, long readVersion); @Nonnull @API(API.Status.INTERNAL) FDBReverseDirectoryCache getReverseDirectoryCache(); @API(API.Status.INTERNAL) int getDirectoryCacheVersion(); CacheStats getDirectoryCacheStats(); @Nonnull @API(API.Status.INTERNAL) Cache<ScopedValue<String>, ResolverResult> getDirectoryCache(int atVersion); @Nonnull @API(API.Status.INTERNAL) Cache<ScopedValue<Long>, String> getReverseDirectoryInMemoryCache(); @API(API.Status.INTERNAL) void clearForwardDirectoryCache(); @VisibleForTesting @API(API.Status.INTERNAL) void clearReverseDirectoryCache(); @Nonnull FDBRecordStoreStateCache getStoreStateCache(); void setStoreStateCache(@Nonnull FDBRecordStoreStateCache storeStateCache); @VisibleForTesting @API(API.Status.INTERNAL) void clearCaches(); synchronized void close(); @Nonnull Executor getExecutor(); @Deprecated @API(API.Status.DEPRECATED) Transaction createTransaction(Executor executor, @Nullable Map<String, String> mdcContext, boolean transactionIsTraced); @Nonnull FDBDatabaseRunner newRunner(@Nonnull FDBRecordContextConfig.Builder contextConfigBuilder); @Nonnull FDBDatabaseRunner newRunner(); @Nonnull FDBDatabaseRunner newRunner(@Nullable FDBStoreTimer timer, @Nullable Map<String, String> mdcContext); @Nonnull FDBDatabaseRunner newRunner(@Nullable FDBStoreTimer timer, @Nullable Map<String, String> mdcContext,
                                       @Nullable WeakReadSemantics weakReadSemantics); T run(@Nonnull Function<? super FDBRecordContext, ? extends T> retriable); T run(@Nullable FDBStoreTimer timer, @Nullable Map<String, String> mdcContext,
                     @Nonnull Function<? super FDBRecordContext, ? extends T> retriable); T run(@Nullable FDBStoreTimer timer, @Nullable Map<String, String> mdcContext, @Nullable WeakReadSemantics weakReadSemantics,
                     @Nonnull Function<? super FDBRecordContext, ? extends T> retriable); @Nonnull @API(API.Status.MAINTAINED) CompletableFuture<T> runAsync(@Nonnull Function<? super FDBRecordContext, CompletableFuture<? extends T>> retriable); @Nonnull @API(API.Status.MAINTAINED) CompletableFuture<T> runAsync(@Nullable FDBStoreTimer timer, @Nullable Map<String, String> mdcContext,
                                             @Nonnull Function<? super FDBRecordContext, CompletableFuture<? extends T>> retriable); @Nonnull @API(API.Status.MAINTAINED) CompletableFuture<T> runAsync(@Nullable FDBStoreTimer timer, @Nullable Map<String, String> mdcContext, @Nullable WeakReadSemantics weakReadSemantics,
                                             @Nonnull Function<? super FDBRecordContext, CompletableFuture<? extends T>> retriable); boolean hasAsyncToSyncTimeout(); @Nullable Pair<Long, TimeUnit> getAsyncToSyncTimeout(FDBStoreTimer.Wait event); @Nullable Function<FDBStoreTimer.Wait, Pair<Long, TimeUnit>> getAsyncToSyncTimeout(); void setAsyncToSyncTimeout(@Nullable Function<FDBStoreTimer.Wait, Pair<Long, TimeUnit>> asyncToSyncTimeout); void setAsyncToSyncTimeout(long asyncToSyncTimeout, @Nonnull TimeUnit asyncToSyncTimeoutUnit); void clearAsyncToSyncTimeout(); void setAsyncToSyncExceptionMapper(@Nonnull ExceptionMapper asyncToSyncExceptionMapper); @Nullable T asyncToSync(@Nullable FDBStoreTimer timer, FDBStoreTimer.Wait event, @Nonnull CompletableFuture<T> async); T join(CompletableFuture<T> future); T joinNow(CompletableFuture<T> future); T get(CompletableFuture<T> future); @VisibleForTesting int warnAndCloseOldTrackedOpenContexts(long minAgeSeconds); @API(API.Status.INTERNAL) BlockingInAsyncDetection getBlockingInAsyncDetection(); CompletableFuture<Tuple> loadBoundaryKeys(@Nonnull FDBTransactionContext context, Tuple key); static final int DEFAULT_MAX_REVERSE_CACHE_ENTRIES; static final int DEFAULT_RESOLVER_STATE_CACHE_REFRESH_SECONDS; }