org.redisson.api.RFuture Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of redisson-all Show documentation
Show all versions of redisson-all Show documentation
Redis based In-Memory Data Grid for Java
/**
* Copyright (c) 2013-2024 Nikita Koksharov
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.redisson.api;
import java.util.concurrent.CompletionStage;
import java.util.concurrent.TimeUnit;
import java.util.function.BiConsumer;
/**
* Represents the result of an asynchronous computation
*
* @author Nikita Koksharov
*
* @param type of value
*/
public interface RFuture extends java.util.concurrent.Future, CompletionStage {
/**
* Use snippet below instead.
*
*
* return toCompletableFuture().isDone() && !toCompletableFuture().isCompletedExceptionally();
*
*
* @return {@code true} if future was completed successfully
*/
@Deprecated
boolean isSuccess();
/**
* Use snippet below instead.
*
*
* if (toCompletableFuture().isDone()) {
* try {
* toCompletableFuture().getNow(null);
* } catch (CompletionException e) {
* return e.getCause();
* } catch (CancellationException e) {
* return e;
* }
* }
* return null;
*
*
* @return the cause of the failure.
* {@code null} if succeeded or this future is not
* completed yet.
*/
@Deprecated
Throwable cause();
/**
* Use snippet below instead.
*
*
* try {
* return toCompletableFuture().getNow(null);
* } catch (Exception e) {
* return null;
* }
*
*
* @return object
*/
@Deprecated
V getNow();
/**
* Use toCompletableFuture().join() method instead
*
* @return the result value
*/
@Deprecated
V join();
/**
* Use snippet below instead.
*
*
* try {
* toCompletableFuture().get();
* } catch (Exception e) {
* // skip
* }
*
*
* @param timeout - wait timeout
* @param unit - time unit
* @return {@code true} if and only if the future was completed within
* the specified time limit
*
* @throws InterruptedException
* if the current thread was interrupted
*/
@Deprecated
boolean await(long timeout, TimeUnit unit) throws InterruptedException;
/**
* Use snippet below instead.
*
*
* try {
* toCompletableFuture().get();
* } catch (Exception e) {
* // skip
* }
*
*
* @param timeoutMillis - timeout value
* @return {@code true} if and only if the future was completed within
* the specified time limit
*
* @throws InterruptedException
* if the current thread was interrupted
*/
@Deprecated
boolean await(long timeoutMillis) throws InterruptedException;
/**
* Use toCompletableFuture().get() method instead
*
* @throws InterruptedException
* if the current thread was interrupted
* @return Future object
*/
@Deprecated
RFuture sync() throws InterruptedException;
/**
* Use toCompletableFuture().join() method instead
*
* @return Future object
*/
@Deprecated
RFuture syncUninterruptibly();
/**
* Use snippet below instead.
*
*
* try {
* toCompletableFuture().get();
* } catch (Exception e) {
* // skip
* }
*
*
* @throws InterruptedException
* if the current thread was interrupted
* @return Future object
*/
@Deprecated
RFuture await() throws InterruptedException;
/**
* Use snippet below instead.
*
*
* try {
* rFuture.toCompletableFuture().join();
* } catch (Exception e) {
* // skip
* }
*
*
* @return Future object
*/
@Deprecated
RFuture awaitUninterruptibly();
/**
* Use snippet below instead.
*
*
* try {
* toCompletableFuture().get();
* } catch (Exception e) {
* // skip
* }
*
*
* @param timeout - timeout value
* @param unit - timeout unit value
* @return {@code true} if and only if the future was completed within
* the specified time limit
*/
@Deprecated
boolean awaitUninterruptibly(long timeout, TimeUnit unit);
/**
* Use snippet below instead.
*
*
* try {
* toCompletableFuture().get();
* } catch (Exception e) {
* // skip
* }
*
*
* @param timeoutMillis - timeout value
* @return {@code true} if and only if the future was completed within
* the specified time limit
*/
@Deprecated
boolean awaitUninterruptibly(long timeoutMillis);
/**
* Use whenComplete() method instead
*
* @param action - callback
*/
@Deprecated
void onComplete(BiConsumer super V, ? super Throwable> action);
}