/** * <p>Adds provided {@link AppSyncQueryWatcher} that is currently in progress.</p> * * <p><b>Note</b>: This method needs to be called right before * {@link AppSyncQueryWatcher#enqueueAndWatch(GraphQLCall.Callback)}.</p> */ void registerQueryWatcher(@Nonnull AppSyncQueryWatcher queryWatcher) { checkNotNull(queryWatcher, "queryWatcher == null"); OperationName operationName = queryWatcher.operation().name(); registerCall(activeQueryWatchers, operationName, queryWatcher); }
private void refetchQueryWatchers() { try { for (OperationName operationName : queryWatchers) { for (AppSyncQueryWatcher queryWatcher : callTracker.activeQueryWatchers(operationName)) { queryWatcher.refetch(); } } } catch (Exception e) { logger.e(e, "Failed to re-fetch query watcher"); } }
/** * <p>Adds provided {@link AppSyncQueryWatcher} that is currently in progress.</p> * * <p><b>Note</b>: This method needs to be called right before * {@link AppSyncQueryWatcher#enqueueAndWatch(GraphQLCall.Callback)}.</p> */ void registerQueryWatcher(@Nonnull AppSyncQueryWatcher queryWatcher) { checkNotNull(queryWatcher, "queryWatcher == null"); OperationName operationName = queryWatcher.operation().name(); registerCall(activeQueryWatchers, operationName, queryWatcher); }
private void refetchQueryWatchers() { try { for (OperationName operationName : queryWatchers) { for (AppSyncQueryWatcher queryWatcher : callTracker.activeQueryWatchers(operationName)) { queryWatcher.refetch(); } } } catch (Exception e) { logger.e(e, "Failed to re-fetch query watcher"); } }
/** * <p>Removes provided {@link AppSyncQueryWatcher} that finished his execution, if it is found, else throws an * {@link AssertionError}.</p> * * If the removal operation is successful and no active running calls are found, then the registered * {@link ApolloCallTracker#idleResourceCallback} is invoked. * * <p><b>Note</b>: This method needs to be called right after an apolloCall is completed (whether successful or * failed).</p> */ void unregisterQueryWatcher(@Nonnull AppSyncQueryWatcher queryWatcher) { checkNotNull(queryWatcher, "queryWatcher == null"); OperationName operationName = queryWatcher.operation().name(); unregisterCall(activeQueryWatchers, operationName, queryWatcher); }
/** * <p>Removes provided {@link AppSyncQueryWatcher} that finished his execution, if it is found, else throws an * {@link AssertionError}.</p> * * If the removal operation is successful and no active running calls are found, then the registered * {@link ApolloCallTracker#idleResourceCallback} is invoked. * * <p><b>Note</b>: This method needs to be called right after an apolloCall is completed (whether successful or * failed).</p> */ void unregisterQueryWatcher(@Nonnull AppSyncQueryWatcher queryWatcher) { checkNotNull(queryWatcher, "queryWatcher == null"); OperationName operationName = queryWatcher.operation().name(); unregisterCall(activeQueryWatchers, operationName, queryWatcher); }