private <T> Single<T> getData(EVCacheClient client, String canonicalKey, Transcoder<T> tc, boolean throwException, boolean hasZF, Scheduler scheduler) { if (client == null) return Single.error(new IllegalArgumentException("Client cannot be null")); if(hashKey.get()) { return Single.error(new IllegalArgumentException("Not supported")); } else { if(tc == null && _transcoder != null) tc = (Transcoder<T>)_transcoder; return client.get(canonicalKey, tc, throwException, hasZF, scheduler).onErrorReturn(ex -> { if (ex instanceof EVCacheReadQueueException) { if (log.isDebugEnabled() && shouldLog()) log.debug("EVCacheReadQueueException while getting data for APP " + _appName + ", key : " + canonicalKey + "; hasZF : " + hasZF, ex); if (!throwException || hasZF) return null; throw sneakyThrow(ex); } else if (ex instanceof EVCacheException) { if (log.isDebugEnabled() && shouldLog()) log.debug("EVCacheException while getting data for APP " + _appName + ", key : " + canonicalKey + "; hasZF : " + hasZF, ex); if (!throwException || hasZF) return null; throw sneakyThrow(ex); } else { if (log.isDebugEnabled() && shouldLog()) log.debug("Exception while getting data for APP " + _appName + ", key : " + canonicalKey, ex); if (!throwException || hasZF) return null; throw sneakyThrow(ex); } }); } }
if (event != null) endEvent(event); return data; }).onErrorReturn(ex -> { if (ex instanceof net.spy.memcached.internal.CheckedOperationTimeoutException) { if (event != null) eventError(event, ex);
}).onErrorReturn(ex -> { if (ex instanceof net.spy.memcached.internal.CheckedOperationTimeoutException) { if (event != null) eventError(event, ex);
@Override public Single<Boolean> isRunning() { return client.performRequestNoRetry(HttpMethod.HEAD, "/", null) .map(v -> true).onErrorReturn(t -> false); } }
createAccountResult.onErrorReturn(throwable -> FinishedIndicator.INSTANCE), sendEmailResult.onErrorReturn(throwable -> FinishedIndicator.INSTANCE), (finishedIndicator, finishedIndicator2) -> FinishedIndicator.INSTANCE );
private Observable<PublishedMessage> sendNMessagesAsync(int numMessages, int offset, RabbitPublisher publisher) { final List<Observable<PublishedMessage>> sendCallbacks = new ArrayList<>(); log.infoWithParams("Scheduling messages to rabbit", "numMessages", numMessages); for (int it = 1; it <= numMessages; it++) { final int id = it + offset; String messageId = String.valueOf(it); sendCallbacks.add( publisher.call( new Exchange(inputExchange), new RoutingKey("routing"), new AMQP.BasicProperties.Builder() .appId("send-messages") .messageId(messageId) .deliveryMode(DeliveryMode.persistent.code) .headers(new HashMap<>()) .build(), new Payload(messageId.getBytes())) .map(aVoid -> new PublishedMessage(id, false)) .onErrorReturn(throwable -> { log.errorWithParams("Failed message.", throwable); return new PublishedMessage(id, true); }) .toObservable()); } return Observable.merge(sendCallbacks); }
private Observable<RxRabbitTests.PublishedMessage> sendNMessagesAsync(int numMessages, int offset, RabbitPublisher publisher) { final List<Observable<RxRabbitTests.PublishedMessage>> sendCallbacks = new ArrayList<>(); log.infoWithParams("Scheduling messages to rabbit", "numMessages", numMessages); for (int it = 1 ; it<=numMessages; it++) { final int id = it+offset; String messageId = String.valueOf(it); sendCallbacks.add( publisher.call( new Exchange(inputExchange), new RoutingKey("routing"), new AMQP.BasicProperties.Builder() .appId("send-messages") .messageId(messageId) .deliveryMode(DeliveryMode.persistent.code) .headers(new HashMap<>()) .build(), new Payload(messageId.getBytes())) .map(aVoid -> new RxRabbitTests.PublishedMessage(id, false)) .onErrorReturn(throwable -> { log.errorWithParams("Failed message.", throwable); return new RxRabbitTests.PublishedMessage(id, true); }) .toObservable()); } return Observable.merge(sendCallbacks); }
.onErrorReturn(t -> { logger.warnf(t, "Job execution of %s for time slice %d failed", jobDetails, timeSlice.getTime()); return new JobExecutionState(jobDetails, timeSlice, t, activeJobs);