@SuppressWarnings("unchecked") @Test public void testRetriableExceptionIsRetried() throws Exception { when(_mockPool.getAllEndPoints()).thenReturn(Lists.newArrayList(mock(ServiceEndPoint.class))); when(_mockPool.executeOnEndPoint(any(ServiceEndPoint.class), any(ServiceCallback.class))) .thenThrow(RuntimeException.class).thenReturn(null); when(_mockPool.isRetriableException(any(Exception.class))).thenReturn(true); AsyncServicePool<Service> pool = newAsyncPool(MoreExecutors.newDirectExecutorService()); RetryPolicy retry = mock(RetryPolicy.class); when(retry.allowRetry(anyInt(), anyLong())).thenReturn(true); Collection<Future<Void>> futures = pool.executeOnAll(retry, mock(ServiceCallback.class)); assertEquals(1, futures.size()); Future<Void> future = futures.iterator().next(); future.get(10, TimeUnit.SECONDS); }
@Override public <R> Collection<Future<R>> executeOnAll(RetryPolicy retry, ServiceCallback<S, R> callback) { return executeOn(ALL_END_POINTS, retry, callback); }
AsyncServicePool implements com.bazaarvoice.ostrich.AsyncServicePool<S> { @Override public <R> Collection<Future<R>> executeOnAll(RetryPolicy retry, ServiceCallback<S, R> callback) { return executeOn(ALL_END_POINTS, retry, callback); } }
AsyncServicePool implements com.bazaarvoice.ostrich.AsyncServicePool<S> { @Override public <R> Collection<Future<R>> executeOnAll(RetryPolicy retry, ServiceCallback<S, R> callback) { return executeOn(ALL_END_POINTS, retry, callback); } AsyncServicePool(Ticker ticker, ServicePool<S> pool, boolean shutdownPoolOnClose,
                            ExecutorService executor, boolean shutdownExecutorOnClose, MetricRegistry metrics); }
AsyncServicePool implements com.bazaarvoice.ostrich.AsyncServicePool<S> { @Override public <R> Collection<Future<R>> executeOnAll(RetryPolicy retry, ServiceCallback<S, R> callback) { return executeOn(ALL_END_POINTS, retry, callback); } AsyncServicePool(Ticker ticker, ServicePool<S> pool, boolean shutdownPoolOnClose,
                            ExecutorService executor, boolean shutdownExecutorOnClose, MetricRegistry metrics); @Override void close(); @Override Future<R> execute(final RetryPolicy retryPolicy, final ServiceCallback<S, R> callback); @Override Future<R> execute(final PartitionContext partitionContext, final RetryPolicy retryPolicy,
                                 final ServiceCallback<S, R> callback); @Override Collection<Future<R>> executeOnAll(RetryPolicy retry, ServiceCallback<S, R> callback); @Override Collection<Future<R>> executeOn(ServiceEndPointPredicate predicate, final RetryPolicy retry,
                                               final ServiceCallback<S, R> callback); @Override int getNumValidEndPoints(); @Override int getNumBadEndPoints(); }
AsyncServicePool implements com.bazaarvoice.ostrich.AsyncServicePool<S> { @Override public <R> Collection<Future<R>> executeOnAll(RetryPolicy retry, ServiceCallback<S, R> callback) { return executeOn(ALL_END_POINTS, retry, callback); } AsyncServicePool(Ticker ticker, ServicePool<S> pool, boolean shutdownPoolOnClose,
                            ExecutorService executor, boolean shutdownExecutorOnClose, MetricRegistry metrics); @Override void close(); @Override Future<R> execute(final RetryPolicy retryPolicy, final ServiceCallback<S, R> callback); @Override Future<R> execute(final PartitionContext partitionContext, final RetryPolicy retryPolicy,
                                 final ServiceCallback<S, R> callback); @Override Collection<Future<R>> executeOnAll(RetryPolicy retry, ServiceCallback<S, R> callback); @Override Collection<Future<R>> executeOn(ServiceEndPointPredicate predicate, final RetryPolicy retry,
                                               final ServiceCallback<S, R> callback); @Override int getNumValidEndPoints(); @Override int getNumBadEndPoints();  }