chore: Remove pekko.util.FutureConverters (#2207)
* chore: Remove pekko.util.FutureConverters
This commit is contained in:
parent
04f5fcd1b7
commit
875840d3b8
41 changed files with 48 additions and 175 deletions
|
|
@ -529,7 +529,7 @@ Scala has proven the most viable way to do it, as long as you keep the following
|
|||
1. If the underlying Scala code requires an `ExecutionContext`, make the Java API take an `Executor` and use
|
||||
`ExecutionContext.fromExecutor(executor)` for conversion.
|
||||
|
||||
1. Use `org.apache.pekko.util.FutureConverters` to translate `Future`s to `CompletionStage`s (or vice versa).
|
||||
1. Use `scala.jdk.FutureConverters` to translate `Future`s to `CompletionStage`s (or vice versa).
|
||||
|
||||
1. Use `scala.jdk.javaapi.OptionConverters` to translate `Option`s to Java `Optional`s (or vice versa).
|
||||
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ import pekko.actor.typed.internal.ActorRefImpl
|
|||
import pekko.actor.typed.internal.InternalRecipientRef
|
||||
import pekko.actor.typed.receptionist.Receptionist
|
||||
import pekko.annotation.InternalApi
|
||||
import pekko.util.FutureConverters._
|
||||
import scala.jdk.FutureConverters._
|
||||
|
||||
/**
|
||||
* INTERNAL API
|
||||
|
|
|
|||
|
|
@ -23,12 +23,12 @@ import java.util.function.BiFunction;
|
|||
import org.apache.pekko.actor.*;
|
||||
import org.apache.pekko.testkit.PekkoJUnitActorSystemResource;
|
||||
import org.apache.pekko.testkit.PekkoSpec;
|
||||
import org.apache.pekko.util.FutureConverters;
|
||||
import org.apache.pekko.util.JavaDurationConverters;
|
||||
import org.junit.ClassRule;
|
||||
import org.junit.Test;
|
||||
import org.scalatestplus.junit.JUnitSuite;
|
||||
import scala.concurrent.Await;
|
||||
import scala.jdk.javaapi.FutureConverters;
|
||||
|
||||
public class CircuitBreakerTest extends JUnitSuite {
|
||||
|
||||
|
|
|
|||
|
|
@ -1,46 +0,0 @@
|
|||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You 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.apache.pekko.util;
|
||||
|
||||
import java.time.Duration;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import scala.Option;
|
||||
import scala.concurrent.Future;
|
||||
import scala.jdk.javaapi.OptionConverters;
|
||||
|
||||
/**
|
||||
* These tests are here to ensure that methods from {@link org.apache.pekko.util.FutureConverters},
|
||||
* {@link org.apache.pekko.util.JavaDurationConverters} for use within Java can be compiled from
|
||||
* with Java sources. This is because methods marked with the Scala 3 inline keyword cannot be
|
||||
* called from within Java (see https://github.com/lampepfl/dotty/issues/19346)
|
||||
*/
|
||||
public class JavaConverterScala3InlineTest {
|
||||
public void compileTest() {
|
||||
OptionConverters.toScala(Optional.empty());
|
||||
OptionConverters.toScala(OptionalDouble.of(0));
|
||||
OptionConverters.toScala(OptionalInt.of(0));
|
||||
OptionConverters.toScala(OptionalLong.of(0));
|
||||
OptionConverters.toJava(Option.empty());
|
||||
|
||||
FutureConverters.asJava(Future.successful(""));
|
||||
FutureConverters.asScala(CompletableFuture.completedFuture(""));
|
||||
|
||||
JavaDurationConverters.asFiniteDuration(Duration.ofMillis(0));
|
||||
}
|
||||
}
|
||||
|
|
@ -42,7 +42,7 @@ import pekko.actor.typed.internal.PropsImpl.DispatcherSameAsParent
|
|||
import pekko.actor.typed.internal.SystemMessage
|
||||
import pekko.actor.typed.scaladsl.Behaviors
|
||||
import pekko.annotation.InternalApi
|
||||
import pekko.util.FutureConverters._
|
||||
import scala.jdk.FutureConverters._
|
||||
|
||||
/**
|
||||
* INTERNAL API. Lightweight wrapper for presenting a classic ActorSystem to a Behavior (via the context).
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ import pekko.actor.typed.Scheduler
|
|||
import pekko.actor.typed.scaladsl.AskPattern._
|
||||
import pekko.japi.function.{ Function => JFunction }
|
||||
import pekko.pattern.StatusReply
|
||||
import pekko.util.FutureConverters._
|
||||
import scala.jdk.FutureConverters._
|
||||
import pekko.util.JavaDurationConverters._
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -20,6 +20,12 @@ ProblemFilters.exclude[DirectMissingMethodProblem]("org.apache.pekko.util.Future
|
|||
ProblemFilters.exclude[DirectMissingMethodProblem]("org.apache.pekko.util.FutureConverters#CompletionStageOps.asScala")
|
||||
ProblemFilters.exclude[DirectMissingMethodProblem]("org.apache.pekko.util.FutureConverters#FutureOps.asJava$extension")
|
||||
ProblemFilters.exclude[DirectMissingMethodProblem]("org.apache.pekko.util.FutureConverters#FutureOps.asJava")
|
||||
ProblemFilters.exclude[MissingClassProblem]("org.apache.pekko.util.FutureConverters")
|
||||
ProblemFilters.exclude[MissingClassProblem]("org.apache.pekko.util.FutureConverters$")
|
||||
ProblemFilters.exclude[MissingClassProblem]("org.apache.pekko.util.FutureConverters$CompletionStageOps")
|
||||
ProblemFilters.exclude[MissingClassProblem]("org.apache.pekko.util.FutureConverters$CompletionStageOps$")
|
||||
ProblemFilters.exclude[MissingClassProblem]("org.apache.pekko.util.FutureConverters$FutureOps")
|
||||
ProblemFilters.exclude[MissingClassProblem]("org.apache.pekko.util.FutureConverters$FutureOps$")
|
||||
ProblemFilters.exclude[MissingClassProblem]("org.apache.pekko.dispatch.internal.SameThreadExecutionContext")
|
||||
ProblemFilters.exclude[MissingClassProblem]("org.apache.pekko.dispatch.internal.SameThreadExecutionContext$")
|
||||
ProblemFilters.exclude[DirectMissingMethodProblem]("org.apache.pekko.dispatch.ExecutionContexts.parasitic")
|
||||
|
|
|
|||
|
|
@ -1,45 +0,0 @@
|
|||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You 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.apache.pekko.util
|
||||
|
||||
import org.apache.pekko.annotation.InternalStableApi
|
||||
|
||||
import java.util.concurrent.CompletionStage
|
||||
import scala.concurrent.Future
|
||||
|
||||
/**
|
||||
* INTERNAL API
|
||||
*
|
||||
* Remove this once Scala 2.12 support is dropped since all methods are in Scala 2.13+ stdlib
|
||||
*/
|
||||
@InternalStableApi
|
||||
private[pekko] object FutureConverters {
|
||||
import scala.jdk.javaapi
|
||||
|
||||
@inline final def asJava[T](f: Future[T]): CompletionStage[T] = javaapi.FutureConverters.asJava(f)
|
||||
|
||||
implicit final class FutureOps[T](private val f: Future[T]) extends AnyVal {
|
||||
@inline def asJava: CompletionStage[T] = javaapi.FutureConverters.asJava(f)
|
||||
}
|
||||
|
||||
@inline final def asScala[T](cs: CompletionStage[T]): Future[T] = javaapi.FutureConverters.asScala(cs)
|
||||
|
||||
implicit final class CompletionStageOps[T](private val cs: CompletionStage[T]) extends AnyVal {
|
||||
@inline def asScala: Future[T] = javaapi.FutureConverters.asScala(cs)
|
||||
}
|
||||
}
|
||||
|
|
@ -1,41 +0,0 @@
|
|||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* license agreements; and to You under the Apache License, version 2.0:
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* This file is part of the Apache Pekko project, derived from Akka.
|
||||
*/
|
||||
|
||||
package org.apache.pekko.util
|
||||
|
||||
import org.apache.pekko.annotation.InternalStableApi
|
||||
|
||||
import java.util.concurrent.CompletionStage
|
||||
import scala.concurrent.Future
|
||||
|
||||
/**
|
||||
* INTERNAL API
|
||||
*
|
||||
* Remove this once Scala 2.12 support is dropped since all methods are in Scala 2.13+ stdlib
|
||||
*/
|
||||
@InternalStableApi
|
||||
private[pekko] object FutureConverters {
|
||||
import scala.jdk.javaapi
|
||||
|
||||
// Ideally this should have the Scala 3 inline keyword but then Java sources are
|
||||
// unable to call this method, see https://github.com/lampepfl/dotty/issues/19346
|
||||
def asJava[T](f: Future[T]): CompletionStage[T] = javaapi.FutureConverters.asJava(f)
|
||||
|
||||
implicit final class FutureOps[T](private val f: Future[T]) extends AnyVal {
|
||||
inline def asJava: CompletionStage[T] = javaapi.FutureConverters.asJava(f)
|
||||
}
|
||||
|
||||
// Ideally this should have the Scala 3 inline keyword but then Java sources are
|
||||
// unable to call this method, see https://github.com/lampepfl/dotty/issues/19346
|
||||
def asScala[T](cs: CompletionStage[T]): Future[T] = javaapi.FutureConverters.asScala(cs)
|
||||
|
||||
implicit final class CompletionStageOps[T](private val cs: CompletionStage[T]) extends AnyVal {
|
||||
inline def asScala: Future[T] = javaapi.FutureConverters.asScala(cs)
|
||||
}
|
||||
}
|
||||
|
|
@ -31,7 +31,6 @@ import scala.concurrent.ExecutionContext
|
|||
import pekko.pattern.ask
|
||||
import pekko.routing.MurmurHash
|
||||
import pekko.util.{ Helpers, JavaDurationConverters, Timeout }
|
||||
import pekko.util.FutureConverters
|
||||
|
||||
/**
|
||||
* An ActorSelection is a logical view of a section of an ActorSystem's tree of Actors,
|
||||
|
|
@ -106,7 +105,7 @@ abstract class ActorSelection extends Serializable {
|
|||
* supplied `timeout`.
|
||||
*/
|
||||
def resolveOne(timeout: java.time.Duration): CompletionStage[ActorRef] = {
|
||||
import FutureConverters._
|
||||
import scala.jdk.FutureConverters._
|
||||
import JavaDurationConverters._
|
||||
resolveOne(timeout.asScala).asJava
|
||||
}
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ import pekko.event.Logging.DefaultLogger
|
|||
import pekko.japi.Util.immutableSeq
|
||||
import pekko.serialization.SerializationExtension
|
||||
import pekko.util._
|
||||
import pekko.util.FutureConverters._
|
||||
import scala.jdk.FutureConverters._
|
||||
import scala.jdk.OptionConverters._
|
||||
import pekko.util.Helpers.toRootLowerCase
|
||||
import pekko.util.ccompat.JavaConverters._
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ import pekko.event.Logging
|
|||
import pekko.pattern.after
|
||||
import scala.jdk.OptionConverters._
|
||||
import pekko.util.OptionVal
|
||||
import pekko.util.FutureConverters._
|
||||
import scala.jdk.FutureConverters._
|
||||
|
||||
object CoordinatedShutdown extends ExtensionId[CoordinatedShutdown] with ExtensionIdProvider {
|
||||
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ object CompletionStages {
|
|||
* Convert a `CompletionStage` to a Scala `Future`.
|
||||
*/
|
||||
def asScala[T](stage: CompletionStage[T]): scala.concurrent.Future[T] = {
|
||||
import org.apache.pekko.util.FutureConverters._
|
||||
import scala.jdk.FutureConverters._
|
||||
stage.asScala
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -88,7 +88,7 @@ object Futures {
|
|||
* @since 1.2.0
|
||||
*/
|
||||
def asJava[T](future: Future[T]): CompletionStage[T] = {
|
||||
import org.apache.pekko.util.FutureConverters._
|
||||
import scala.jdk.FutureConverters._
|
||||
future.asJava
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ import pekko.actor.{ ExtendedActorSystem, Scheduler }
|
|||
import scala.concurrent.ExecutionContext.parasitic
|
||||
import pekko.pattern.internal.{ CircuitBreakerNoopTelemetry, CircuitBreakerTelemetry }
|
||||
import pekko.annotation.InternalApi
|
||||
import pekko.util.FutureConverters._
|
||||
import scala.jdk.FutureConverters._
|
||||
import pekko.util.JavaDurationConverters._
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ import scala.concurrent.ExecutionContext
|
|||
|
||||
import org.apache.pekko
|
||||
import pekko.actor.{ ActorSelection, ClassicActorSystemProvider, Scheduler }
|
||||
import pekko.util.FutureConverters._
|
||||
import scala.jdk.FutureConverters._
|
||||
import pekko.util.JavaDurationConverters._
|
||||
|
||||
import scala.annotation.nowarn
|
||||
|
|
|
|||
|
|
@ -76,7 +76,7 @@ abstract class AsyncSerializerWithStringManifest(system: ExtendedActorSystem)
|
|||
*/
|
||||
abstract class AsyncSerializerWithStringManifestCS(system: ExtendedActorSystem)
|
||||
extends AsyncSerializerWithStringManifest(system) {
|
||||
import pekko.util.FutureConverters._
|
||||
import scala.jdk.FutureConverters._
|
||||
|
||||
def toBinaryAsyncCS(o: AnyRef): CompletionStage[Array[Byte]]
|
||||
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ import pekko.pattern.AskTimeoutException
|
|||
import pekko.pattern.PromiseActorRef
|
||||
import pekko.pattern.StatusReply
|
||||
import pekko.util.{ unused, ByteString, Timeout }
|
||||
import pekko.util.FutureConverters._
|
||||
import scala.jdk.FutureConverters._
|
||||
import pekko.util.JavaDurationConverters._
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ import pekko.cluster.sharding.typed.javadsl.EntityRef
|
|||
import pekko.cluster.sharding.typed.scaladsl
|
||||
import pekko.japi.function.{ Function => JFunction }
|
||||
import pekko.pattern.StatusReply
|
||||
import pekko.util.FutureConverters._
|
||||
import scala.jdk.FutureConverters._
|
||||
import pekko.util.JavaDurationConverters._
|
||||
import pekko.util.Timeout
|
||||
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ import pekko.cluster.sharding.external.ShardLocations
|
|||
import pekko.dispatch.MessageDispatcher
|
||||
import pekko.event.Logging
|
||||
import pekko.pattern.ask
|
||||
import pekko.util.FutureConverters._
|
||||
import scala.jdk.FutureConverters._
|
||||
import pekko.util.JavaDurationConverters._
|
||||
import pekko.util.PrettyDuration._
|
||||
import pekko.util.Timeout
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ import pekko.annotation.InternalApi
|
|||
import pekko.coordination.lease.LeaseSettings
|
||||
import pekko.coordination.lease.javadsl.{ Lease => JavaLease }
|
||||
import pekko.coordination.lease.scaladsl.{ Lease => ScalaLease }
|
||||
import pekko.util.FutureConverters._
|
||||
import scala.jdk.FutureConverters._
|
||||
import scala.jdk.OptionConverters._
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -321,7 +321,7 @@ abstract class ServiceDiscovery {
|
|||
* The returned future should be failed once resolveTimeout has passed with a [[ServiceDiscovery.DiscoveryTimeoutException]].
|
||||
*/
|
||||
def lookup(query: Lookup, resolveTimeout: java.time.Duration): CompletionStage[Resolved] = {
|
||||
import pekko.util.FutureConverters._
|
||||
import scala.jdk.FutureConverters._
|
||||
lookup(query, FiniteDuration(resolveTimeout.toMillis, TimeUnit.MILLISECONDS)).asJava
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ import org.apache.pekko
|
|||
import pekko.Done
|
||||
import pekko.actor.ClassicActorSystemProvider
|
||||
import pekko.persistence.testkit.scaladsl
|
||||
import pekko.util.FutureConverters._
|
||||
import scala.jdk.FutureConverters._
|
||||
import pekko.util.JavaDurationConverters._
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ import pekko.persistence.state.javadsl.DurableStateUpdateStore
|
|||
import pekko.persistence.state.javadsl.GetObjectResult
|
||||
import pekko.persistence.testkit.state.scaladsl.{ PersistenceTestKitDurableStateStore => SStore }
|
||||
import pekko.stream.javadsl.Source
|
||||
import pekko.util.FutureConverters._
|
||||
import scala.jdk.FutureConverters._
|
||||
import scala.jdk.OptionConverters._
|
||||
|
||||
object PersistenceTestKitDurableStateStore {
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ import scala.concurrent.ExecutionContext
|
|||
import pekko.persistence.PersistentRepr
|
||||
import pekko.persistence.journal.{ AsyncRecovery => SAsyncReplay }
|
||||
import pekko.util.ConstantFun.scalaAnyToUnit
|
||||
import pekko.util.FutureConverters._
|
||||
import scala.jdk.FutureConverters._
|
||||
|
||||
/**
|
||||
* Java API: asynchronous message replay and sequence number recovery interface.
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ import scala.concurrent.ExecutionContext
|
|||
import pekko.persistence._
|
||||
import pekko.persistence.journal.{ AsyncWriteJournal => SAsyncWriteJournal }
|
||||
import pekko.util.ConstantFun.scalaAnyToUnit
|
||||
import pekko.util.FutureConverters._
|
||||
import scala.jdk.FutureConverters._
|
||||
import pekko.util.ccompat.JavaConverters._
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ import scala.concurrent.ExecutionContext
|
|||
import pekko.persistence._
|
||||
import pekko.persistence.snapshot.{ SnapshotStore => SSnapshotStore }
|
||||
import pekko.util.ConstantFun.scalaAnyToUnit
|
||||
import pekko.util.FutureConverters._
|
||||
import scala.jdk.FutureConverters._
|
||||
|
||||
/**
|
||||
* Java API: abstract snapshot store.
|
||||
|
|
|
|||
|
|
@ -133,7 +133,7 @@ class AsyncCallbackSpec extends PekkoSpec("""
|
|||
// test it can be used from Java too
|
||||
val completionStage = callback.invokeWithFeedbackCompletionStage("whatever")
|
||||
probe.expectMsg("whatever")
|
||||
import pekko.util.FutureConverters._
|
||||
import scala.jdk.FutureConverters._
|
||||
completionStage.asScala.futureValue should ===(Done)
|
||||
|
||||
in.sendComplete()
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ import pekko.japi.function.Creator
|
|||
import pekko.stream.{ javadsl, _ }
|
||||
import pekko.stream.impl.fusing.{ StatefulMapConcat, ZipWithIndexJava }
|
||||
import pekko.util.ConstantFun
|
||||
import pekko.util.FutureConverters._
|
||||
import scala.jdk.FutureConverters._
|
||||
import pekko.util.JavaDurationConverters._
|
||||
import scala.jdk.OptionConverters._
|
||||
import pekko.util.Timeout
|
||||
|
|
@ -273,7 +273,7 @@ object Flow {
|
|||
* [[NeverMaterializedException]] if upstream fails or downstream cancels before the completion stage has completed.
|
||||
*/
|
||||
def completionStageFlow[I, O, M](flow: CompletionStage[Flow[I, O, M]]): Flow[I, O, CompletionStage[M]] = {
|
||||
import pekko.util.FutureConverters._
|
||||
import scala.jdk.FutureConverters._
|
||||
val sflow =
|
||||
scaladsl.Flow.futureFlow(flow.asScala.map(_.asScala)(ExecutionContext.parasitic)).mapMaterializedValue(_.asJava)
|
||||
new javadsl.Flow(sflow)
|
||||
|
|
@ -295,7 +295,7 @@ object Flow {
|
|||
* '''Cancels when''' downstream cancels
|
||||
*/
|
||||
def lazyFlow[I, O, M](create: Creator[Flow[I, O, M]]): Flow[I, O, CompletionStage[M]] = {
|
||||
import pekko.util.FutureConverters._
|
||||
import scala.jdk.FutureConverters._
|
||||
val sflow = scaladsl.Flow
|
||||
.lazyFlow { () =>
|
||||
create.create().asScala
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ import pekko.event.{ LogMarker, LoggingAdapter, MarkerLoggingAdapter }
|
|||
import pekko.japi.{ function, Pair }
|
||||
import pekko.stream._
|
||||
import pekko.util.ConstantFun
|
||||
import pekko.util.FutureConverters._
|
||||
import scala.jdk.FutureConverters._
|
||||
import pekko.util.JavaDurationConverters._
|
||||
import scala.jdk.OptionConverters._
|
||||
import pekko.util.ccompat.JavaConverters._
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ import org.apache.pekko
|
|||
import pekko.Done
|
||||
import scala.concurrent.ExecutionContext
|
||||
import pekko.stream.QueueOfferResult
|
||||
import pekko.util.FutureConverters._
|
||||
import scala.jdk.FutureConverters._
|
||||
import scala.jdk.OptionConverters._
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ import pekko.stream._
|
|||
import pekko.stream.impl.LinearTraversalBuilder
|
||||
import pekko.stream.scaladsl.SinkToCompletionStage
|
||||
import pekko.util.ConstantFun.scalaAnyToUnit
|
||||
import pekko.util.FutureConverters._
|
||||
import scala.jdk.FutureConverters._
|
||||
import scala.jdk.OptionConverters._
|
||||
|
||||
import org.reactivestreams.{ Publisher, Subscriber }
|
||||
|
|
@ -94,7 +94,7 @@ object Sink {
|
|||
* @since 1.1.0
|
||||
*/
|
||||
def forall[In](p: function.Predicate[In]): javadsl.Sink[In, CompletionStage[java.lang.Boolean]] = {
|
||||
import pekko.util.FutureConverters._
|
||||
import scala.jdk.FutureConverters._
|
||||
new Sink(scaladsl.Sink.forall[In](p.test)
|
||||
.mapMaterializedValue(_.map(Boolean.box)(ExecutionContext.parasitic).asJava))
|
||||
}
|
||||
|
|
@ -119,7 +119,7 @@ object Sink {
|
|||
* @since 1.2.0
|
||||
*/
|
||||
def none[In](p: function.Predicate[In]): javadsl.Sink[In, CompletionStage[java.lang.Boolean]] = {
|
||||
import pekko.util.FutureConverters._
|
||||
import scala.jdk.FutureConverters._
|
||||
new Sink(scaladsl.Sink.none[In](p.test)
|
||||
.mapMaterializedValue(_.map(Boolean.box)(ExecutionContext.parasitic).asJava))
|
||||
}
|
||||
|
|
@ -144,7 +144,7 @@ object Sink {
|
|||
* @since 1.1.0
|
||||
*/
|
||||
def exists[In](p: function.Predicate[In]): javadsl.Sink[In, CompletionStage[java.lang.Boolean]] = {
|
||||
import pekko.util.FutureConverters._
|
||||
import scala.jdk.FutureConverters._
|
||||
new Sink(scaladsl.Sink.exists[In](p.test)
|
||||
.mapMaterializedValue(_.map(Boolean.box)(ExecutionContext.parasitic).asJava))
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ import pekko.stream._
|
|||
import pekko.stream.impl.{ LinearTraversalBuilder, UnfoldAsyncJava, UnfoldJava }
|
||||
import pekko.stream.impl.fusing.{ ArraySource, StatefulMapConcat, ZipWithIndexJava }
|
||||
import pekko.util.{ unused, _ }
|
||||
import pekko.util.FutureConverters._
|
||||
import scala.jdk.FutureConverters._
|
||||
import pekko.util.JavaDurationConverters._
|
||||
import scala.jdk.OptionConverters._
|
||||
import pekko.util.ccompat.JavaConverters._
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ import pekko.japi.Pair
|
|||
import pekko.japi.function
|
||||
import pekko.stream._
|
||||
import pekko.util.ConstantFun
|
||||
import pekko.util.FutureConverters._
|
||||
import scala.jdk.FutureConverters._
|
||||
import pekko.util.JavaDurationConverters._
|
||||
import scala.jdk.OptionConverters._
|
||||
import pekko.util.ccompat.JavaConverters._
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ import pekko.japi.{ function, Pair }
|
|||
import pekko.stream._
|
||||
import pekko.stream.impl.fusing.{ StatefulMapConcat, ZipWithIndexJava }
|
||||
import pekko.util.ConstantFun
|
||||
import pekko.util.FutureConverters._
|
||||
import scala.jdk.FutureConverters._
|
||||
import pekko.util.JavaDurationConverters._
|
||||
import scala.jdk.OptionConverters._
|
||||
import pekko.util.ccompat.JavaConverters._
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ import pekko.japi.{ function, Pair }
|
|||
import pekko.stream._
|
||||
import pekko.stream.impl.fusing.{ StatefulMapConcat, ZipWithIndexJava }
|
||||
import pekko.util.ConstantFun
|
||||
import pekko.util.FutureConverters._
|
||||
import scala.jdk.FutureConverters._
|
||||
import pekko.util.JavaDurationConverters._
|
||||
import scala.jdk.OptionConverters._
|
||||
import pekko.util.ccompat.JavaConverters._
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ import pekko.stream.SystemMaterializer
|
|||
import pekko.stream.TLSClosing
|
||||
import pekko.stream.scaladsl
|
||||
import pekko.util.ByteString
|
||||
import pekko.util.FutureConverters._
|
||||
import scala.jdk.FutureConverters._
|
||||
import pekko.util.JavaDurationConverters._
|
||||
import scala.jdk.OptionConverters._
|
||||
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ import pekko.Done
|
|||
import pekko.annotation.InternalApi
|
||||
import scala.concurrent.ExecutionContext
|
||||
import pekko.stream.QueueOfferResult
|
||||
import pekko.util.FutureConverters._
|
||||
import scala.jdk.FutureConverters._
|
||||
import scala.jdk.OptionConverters._
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ import pekko.stream.impl.fusing.{ GraphStages, IterableSource, LazyFutureSource,
|
|||
import pekko.stream.impl.fusing.GraphStages._
|
||||
import pekko.stream.stage.GraphStageWithMaterializedValue
|
||||
import pekko.util.ConstantFun
|
||||
import pekko.util.FutureConverters._
|
||||
import scala.jdk.FutureConverters._
|
||||
|
||||
import org.reactivestreams.{ Publisher, Subscriber }
|
||||
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ import java.util.concurrent.CompletionStage
|
|||
|
||||
import scala.concurrent.Future
|
||||
|
||||
import org.apache.pekko.util.FutureConverters._
|
||||
import scala.jdk.FutureConverters._
|
||||
|
||||
/**
|
||||
* Scala API: The flow DSL allows the formulation of stream transformations based on some
|
||||
|
|
|
|||
|
|
@ -1686,7 +1686,7 @@ trait AsyncCallback[T] {
|
|||
* @since 1.2.0
|
||||
*/
|
||||
def invokeWithFeedbackCompletionStage(msg: T): CompletionStage[Done] = {
|
||||
import pekko.util.FutureConverters._
|
||||
import scala.jdk.FutureConverters._
|
||||
invokeWithFeedback(msg).asJava
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue