Java Code Examples for io.lettuce.core.RedisFuture#whenComplete()

The following examples show how to use io.lettuce.core.RedisFuture#whenComplete() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TracingRedisAdvancedClusterAsyncCommands.java    From java-redis-client with Apache License 2.0 5 votes vote down vote up
private <V> RedisFuture<V> setCompleteAction(RedisFuture<V> future, Span span) {
  future.whenComplete((v, throwable) -> {
    if (throwable != null) {
      onError(throwable, span);
    }
    span.finish();
  });

  return future;
}
 
Example 2
Source File: TracingRedisAdvancedClusterAsyncCommands.java    From java-redis-client with Apache License 2.0 5 votes vote down vote up
private <T> RedisFuture<T> continueScopeSpan(RedisFuture<T> redisFuture) {
  Tracer tracer = tracingConfiguration.getTracer();
  Span span = tracer.activeSpan();
  CompletableRedisFuture<T> customRedisFuture = new CompletableRedisFuture<>(redisFuture);
  redisFuture.whenComplete((v, throwable) -> {
    try (Scope ignored = tracer.scopeManager().activate(span)) {
      if (throwable != null) {
        customRedisFuture.completeExceptionally(throwable);
      } else {
        customRedisFuture.complete(v);
      }
    }
  });
  return customRedisFuture;
}
 
Example 3
Source File: TracingRedisAsyncCommands.java    From java-redis-client with Apache License 2.0 5 votes vote down vote up
private <V> RedisFuture<V> setCompleteAction(RedisFuture<V> future, Span span) {
  future.whenComplete((v, throwable) -> {
    if (throwable != null) {
      onError(throwable, span);
    }
    span.finish();
  });

  return future;
}
 
Example 4
Source File: TracingRedisAsyncCommands.java    From java-redis-client with Apache License 2.0 5 votes vote down vote up
private <T> RedisFuture<T> continueScopeSpan(RedisFuture<T> redisFuture) {
  Tracer tracer = tracingConfiguration.getTracer();
  Span span = tracer.activeSpan();
  CompletableRedisFuture<T> customRedisFuture = new CompletableRedisFuture<>(redisFuture);
  redisFuture.whenComplete((v, throwable) -> {
    try (Scope ignored = tracer.scopeManager().activate(span)) {
      if (throwable != null) {
        customRedisFuture.completeExceptionally(throwable);
      } else {
        customRedisFuture.complete(v);
      }
    }
  });
  return customRedisFuture;
}
 
Example 5
Source File: TracingRedisAdvancedClusterAsyncCommands.java    From java-redis-client with Apache License 2.0 5 votes vote down vote up
private <V> RedisFuture<V> setCompleteAction(RedisFuture<V> future, Span span) {
  future.whenComplete((v, throwable) -> {
    if (throwable != null) {
      onError(throwable, span);
    }
    span.finish();
  });

  return future;
}
 
Example 6
Source File: TracingRedisAdvancedClusterAsyncCommands.java    From java-redis-client with Apache License 2.0 5 votes vote down vote up
private <T> RedisFuture<T> continueScopeSpan(RedisFuture<T> redisFuture) {
  Tracer tracer = tracingConfiguration.getTracer();
  Span span = tracer.activeSpan();
  CompletableRedisFuture<T> customRedisFuture = new CompletableRedisFuture<>(redisFuture);
  redisFuture.whenComplete((v, throwable) -> {
    try (Scope ignored = tracer.scopeManager().activate(span)) {
      if (throwable != null) {
        customRedisFuture.completeExceptionally(throwable);
      } else {
        customRedisFuture.complete(v);
      }
    }
  });
  return customRedisFuture;
}
 
Example 7
Source File: TracingRedisAsyncCommands.java    From java-redis-client with Apache License 2.0 5 votes vote down vote up
private <V> RedisFuture<V> setCompleteAction(RedisFuture<V> future, Span span) {
  future.whenComplete((v, throwable) -> {
    if (throwable != null) {
      onError(throwable, span);
    }
    span.finish();
  });

  return future;
}
 
Example 8
Source File: TracingRedisAsyncCommands.java    From java-redis-client with Apache License 2.0 5 votes vote down vote up
private <T> RedisFuture<T> continueScopeSpan(RedisFuture<T> redisFuture) {
  Tracer tracer = tracingConfiguration.getTracer();
  Span span = tracer.activeSpan();
  CompletableRedisFuture<T> customRedisFuture = new CompletableRedisFuture<>(redisFuture);
  redisFuture.whenComplete((v, throwable) -> {
    try (Scope ignored = tracer.scopeManager().activate(span)) {
      if (throwable != null) {
        customRedisFuture.completeExceptionally(throwable);
      } else {
        customRedisFuture.complete(v);
      }
    }
  });
  return customRedisFuture;
}
 
Example 9
Source File: TracingRedisAdvancedClusterAsyncCommands.java    From java-redis-client with Apache License 2.0 5 votes vote down vote up
private <V> RedisFuture<V> setCompleteAction(RedisFuture<V> future, Span span) {
  future.whenComplete((v, throwable) -> {
    if (throwable != null) {
      onError(throwable, span);
    }
    span.finish();
  });

  return future;
}
 
Example 10
Source File: TracingRedisAdvancedClusterAsyncCommands.java    From java-redis-client with Apache License 2.0 5 votes vote down vote up
private <T> RedisFuture<T> continueScopeSpan(RedisFuture<T> redisFuture) {
  Tracer tracer = tracingConfiguration.getTracer();
  Span span = tracer.activeSpan();
  CompletableRedisFuture<T> customRedisFuture = new CompletableRedisFuture<>(redisFuture);
  redisFuture.whenComplete((v, throwable) -> {
    try (Scope ignored = tracer.scopeManager().activate(span)) {
      if (throwable != null) {
        customRedisFuture.completeExceptionally(throwable);
      } else {
        customRedisFuture.complete(v);
      }
    }
  });
  return customRedisFuture;
}
 
Example 11
Source File: TracingRedisAsyncCommands.java    From java-redis-client with Apache License 2.0 5 votes vote down vote up
private <V> RedisFuture<V> setCompleteAction(RedisFuture<V> future, Span span) {
  future.whenComplete((v, throwable) -> {
    if (throwable != null) {
      onError(throwable, span);
    }
    span.finish();
  });

  return future;
}
 
Example 12
Source File: TracingRedisAsyncCommands.java    From java-redis-client with Apache License 2.0 5 votes vote down vote up
private <T> RedisFuture<T> continueScopeSpan(RedisFuture<T> redisFuture) {
  Tracer tracer = tracingConfiguration.getTracer();
  Span span = tracer.activeSpan();
  CompletableRedisFuture<T> customRedisFuture = new CompletableRedisFuture<>(redisFuture);
  redisFuture.whenComplete((v, throwable) -> {
    try (Scope ignored = tracer.scopeManager().activate(span)) {
      if (throwable != null) {
        customRedisFuture.completeExceptionally(throwable);
      } else {
        customRedisFuture.complete(v);
      }
    }
  });
  return customRedisFuture;
}