Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unix Domain Socket: add access with new actors API #2212

Merged
merged 1 commit into from
Mar 18, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ import java.util.concurrent.CompletionStage
import scala.compat.java8.OptionConverters._
import scala.compat.java8.FutureConverters._
import akka.NotUsed
import akka.actor.{ActorSystem, ExtendedActorSystem, Extension, ExtensionId, ExtensionIdProvider}
import akka.stream.alpakka.unixdomainsocket.scaladsl.{UnixDomainSocket => ScalaUnixDomainSocket}
import akka.actor.{ClassicActorSystemProvider, ExtendedActorSystem, Extension, ExtensionId, ExtensionIdProvider}
import akka.stream.javadsl.{Flow, Source}
import akka.stream.Materializer
import akka.util.ByteString
Expand All @@ -25,7 +24,7 @@ object UnixDomainSocket extends ExtensionId[UnixDomainSocket] with ExtensionIdPr
/**
* Represents a prospective UnixDomainSocket server binding.
*/
final class ServerBinding private[akka] (delegate: ScalaUnixDomainSocket.ServerBinding) {
final class ServerBinding private[akka] (delegate: scaladsl.UnixDomainSocket.ServerBinding) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍


/**
* The local address of the endpoint bound by the materialization of the `connections` [[akka.stream.javadsl.Source Source]].
Expand All @@ -44,7 +43,7 @@ object UnixDomainSocket extends ExtensionId[UnixDomainSocket] with ExtensionIdPr
/**
* Represents an accepted incoming UnixDomainSocket connection.
*/
final class IncomingConnection private[akka] (delegate: ScalaUnixDomainSocket.IncomingConnection) {
final class IncomingConnection private[akka] (delegate: scaladsl.UnixDomainSocket.IncomingConnection) {

/**
* The local address this connection is bound to.
Expand Down Expand Up @@ -75,7 +74,7 @@ object UnixDomainSocket extends ExtensionId[UnixDomainSocket] with ExtensionIdPr
/**
* Represents a prospective outgoing UnixDomainSocket connection.
*/
final class OutgoingConnection private[akka] (delegate: ScalaUnixDomainSocket.OutgoingConnection) {
final class OutgoingConnection private[akka] (delegate: scaladsl.UnixDomainSocket.OutgoingConnection) {

/**
* The remote address this connection is or will be bound to.
Expand All @@ -88,8 +87,15 @@ object UnixDomainSocket extends ExtensionId[UnixDomainSocket] with ExtensionIdPr
def localAddress: UnixSocketAddress = delegate.localAddress
}

override def get(system: ActorSystem): UnixDomainSocket =
super.get(system)
/**
* Get the UnixDomainSocket extension with the classic actors API.
*/
override def get(system: akka.actor.ActorSystem): UnixDomainSocket = super.apply(system)

/**
* Get the UnixDomainSocket extension with the new actors API.
*/
def get(system: ClassicActorSystemProvider): UnixDomainSocket = super.apply(system.classicSystem)

def lookup(): ExtensionId[_ <: Extension] =
UnixDomainSocket
Expand All @@ -102,7 +108,7 @@ final class UnixDomainSocket(system: ExtendedActorSystem) extends akka.actor.Ext
import UnixDomainSocket._
import akka.dispatch.ExecutionContexts.{sameThreadExecutionContext => ec}

private lazy val delegate: ScalaUnixDomainSocket = ScalaUnixDomainSocket(system)
private lazy val delegate: scaladsl.UnixDomainSocket = scaladsl.UnixDomainSocket(system)

/**
* Creates a [[UnixDomainSocket.ServerBinding]] instance which represents a prospective UnixDomainSocket server binding on the given `endpoint`.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ package scaladsl
import java.nio.file.Path

import akka.NotUsed
import akka.actor.{ActorSystem, ExtendedActorSystem, Extension, ExtensionId, ExtensionIdProvider}
import akka.actor.{ClassicActorSystemProvider, ExtendedActorSystem, Extension, ExtensionId, ExtensionIdProvider}
import akka.stream._
import akka.stream.alpakka.unixdomainsocket.impl.UnixDomainSocketImpl
import akka.stream.scaladsl.{Flow, Keep, Sink, Source}
Expand All @@ -19,7 +19,15 @@ import scala.concurrent.duration.Duration

object UnixDomainSocket extends ExtensionId[UnixDomainSocket] with ExtensionIdProvider {

def apply()(implicit system: ActorSystem): UnixDomainSocket = super.apply(system)
/**
* Get the UnixDomainSocket extension with the classic actors API.
*/
def apply()(implicit system: akka.actor.ActorSystem): UnixDomainSocket = super.apply(system)

/**
* Get the UnixDomainSocket extension with the new actors API.
*/
def apply(system: ClassicActorSystemProvider): UnixDomainSocket = super.apply(system.classicSystem)

override def createExtension(system: ExtendedActorSystem) =
new UnixDomainSocket(system)
Expand Down