@Override public DefaultConnectionFuture<Void> thenAcceptAsync(Consumer<? super T> action, Executor executor) { return adopt(delegate.thenAcceptAsync(action, executor)); }
@Override public DefaultConnectionFuture<Void> thenAcceptAsync(Consumer<? super T> action) { return adopt(delegate.thenAcceptAsync(action)); }
@Override public ListenableFuture<T> addListener(Runnable listener, Executor exec) { future.thenAcceptAsync(r -> listener.run(), exec); return this; }
@Override public CompletableFuture<Void> thenAcceptAsync(Consumer<? super T> action, Executor executor) { return wrap(super.thenAcceptAsync(action, executor)); }
@Override public CompletableFuture<Void> thenAcceptAsync(Consumer<? super T> action) { return wrap(super.thenAcceptAsync(action)); }
@SafeVarargs public static <T> CompletableFuture<T> allOf( T defaultValue, BinaryOperator<T> merger, CompletableFuture<T>... futures) { @SuppressWarnings("unchecked") final CompletableFuture<Void>[] accumulators = (CompletableFuture<Void>[]) Array.newInstance( CompletableFuture.class, futures.length ); final AtomicReference<T> result = new AtomicReference<>(defaultValue); for (int i = 0; i < futures.length; i++) { final CompletableFuture<T> future = futures[i]; accumulators[i] = future.thenAcceptAsync(r -> result.accumulateAndGet(r, merger)); } return CompletableFuture.allOf(accumulators) .thenApplyAsync(v -> result.get()); }
@Override public Task<java.lang.Void> thenAcceptAsync(Consumer<? super T> consumer, Executor executor) { return Task.from(super.thenAcceptAsync(TaskContext.wrap(consumer), executor)); }
@Override public CompletableFuture<Void> thenAcceptAsync(Consumer<? super T> action, Executor executor) { return ctx.makeContextAware(super.thenAcceptAsync(ctx.makeContextAware(action), executor)); }
@Override public CompletableFuture<Void> thenAcceptAsync(Consumer<? super T> action) { return ctx.makeContextAware(super.thenAcceptAsync(ctx.makeContextAware(action))); }
@Override protected void channelRead0(ChannelHandlerContext ctx, HttpRequest httpRequest) { CompletableFuture<HttpRequest> future = CompletableFuture.completedFuture(httpRequest); Executor executor = ctx.executor(); future.thenApplyAsync(req -> buildWebContext(ctx, req), executor) .thenApplyAsync(this::executeLogic, executor) .thenApplyAsync(this::buildResponse, executor) .exceptionally(this::handleException) .thenAcceptAsync(msg -> writeResponse(ctx, future, msg), ctx.channel().eventLoop()); }
@Override public Task<java.lang.Void> thenAcceptAsync(Consumer<? super T> consumer) { return Task.from(super.thenAcceptAsync(TaskContext.wrap(consumer))); }
@Override public CompletableFuture<Void> thenAcceptAsync(Consumer<? super T> action) { return wrap(orderedFuture().thenAcceptAsync(action)); }
@Override protected void channelRead0(ChannelHandlerContext ctx, HttpRequest httpRequest) { CompletableFuture<HttpRequest> future = CompletableFuture.completedFuture(httpRequest); Executor executor = ctx.executor(); future.thenApplyAsync(req -> buildWebContext(ctx, req), executor) .thenApplyAsync(this::executeLogic, executor) .thenApplyAsync(this::buildResponse, executor) .exceptionally(this::handleException) .thenAcceptAsync(msg -> writeResponse(ctx, future, msg), ctx.channel().eventLoop()); }
@Override public CompletableFuture<Void> thenAcceptAsync(Consumer<? super T> action, Executor executor) { return wrap(orderedFuture().thenAcceptAsync(action, executor)); }
@Override @SuppressWarnings("FutureReturnValueIgnored") public void onRemoval(@Nullable K key, @Nullable CompletableFuture<V> future, RemovalCause cause) { if (future != null) { future.thenAcceptAsync(value -> delegate.onRemoval(key, value, cause), executor); } }
@Override public Task<Void> thenAccept(final Consumer<? super T> action) { final Consumer<? super T> wrap = TaskContext.wrap(action); if (defaultExecutor != null) { return from(super.thenAcceptAsync(wrap, defaultExecutor)); } return from(super.thenAccept(wrap)); }
/** * Gets every player that has ever played on this server. * * @return An OfflinePlayer[] future. */ public CompletableFuture<OfflinePlayer[]> getOfflinePlayersAsync() { Set<OfflinePlayer> result = new HashSet<>(); Set<UUID> uuids = new HashSet<>(); // add the currently online players for (World world : getWorlds()) { for (Player player : world.getPlayers()) { result.add(player); uuids.add(player.getUniqueId()); } } return getPlayerDataService().getOfflinePlayers() .thenAcceptAsync(offlinePlayers -> offlinePlayers.stream() .filter(offline -> !uuids.contains(offline.getUniqueId())) .forEach(offline -> { result.add(offline); uuids.add(offline.getUniqueId()); })).thenApply((v) -> result.toArray(new OfflinePlayer[result.size()])); }
private boolean setOwningPlayerInternal(OfflinePlayer owningPlayer) { if (owningPlayer instanceof GlowOfflinePlayer) { GlowOfflinePlayer impl = (GlowOfflinePlayer) owningPlayer; this.owner.set(impl.getProfile()); return true; } else if (owningPlayer instanceof GlowPlayer) { this.owner.set(((GlowPlayer) owningPlayer).getProfile()); return true; } else { CompletableFuture<GlowPlayerProfile> profileFuture = GlowPlayerProfile .getProfile(owningPlayer.getName()); GlowPlayerProfile profile = profileFuture.getNow(null); if (profile != null) { this.owner.set(profile); return true; } else { profileFuture.thenAcceptAsync(this.owner::set); return false; } } } }
schema.tables().map(table -> sqlTypeMapping.thenAcceptAsync(mapping -> { try (final Connection connection = getConnection(dbms)) { progressListener.setCurrentAction(actionName(table));
try { version.latestVersion() .thenAcceptAsync(release -> runLater(() -> { final int compare = SEMANTIC_VERSION.compare( release, info.getImplementationVersion()