
io.reactiverse.es4x.impl.future.ES4XFutureFactory Maven / Gradle / Ivy
/*
* Copyright 2018 Red Hat, Inc.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* and Apache License v2.0 which accompanies this distribution.
*
* The Eclipse Public License is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* The Apache License v2.0 is available at
* http://www.opensource.org/licenses/apache2.0.php
*
* You may elect to redistribute this code under either of these licenses.
*/
package io.reactiverse.es4x.impl.future;
import io.vertx.core.Future;
import io.vertx.core.Promise;
import io.vertx.core.spi.FutureFactory;
/**
* @author Tim Fox
* @author Paulo Lopes
*/
public class ES4XFutureFactory implements FutureFactory {
private static final ES4XSucceededFuture EMPTY = new ES4XSucceededFuture<>(null);
@Override
public Promise promise() {
return new ES4XFuture<>();
}
@Override
public Future future() {
return new ES4XFuture<>();
}
@Override
public Future succeededFuture() {
@SuppressWarnings("unchecked")
Future fut = EMPTY;
return fut;
}
@Override
public Future succeededFuture(T result) {
return new ES4XSucceededFuture<>(result);
}
@Override
public Future failedFuture(Throwable t) {
return new ES4XFailedFuture<>(t);
}
@Override
public Future failureFuture(String failureMessage) {
return new ES4XFailedFuture<>(failureMessage);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy