Akka Remote now compiles and tests pass
This commit is contained in:
parent
d08489c17b
commit
083039d379
8 changed files with 25 additions and 35 deletions
|
|
@ -139,7 +139,7 @@ private[akka] class Deployer(val settings: ActorSystem.Settings, val dynamicAcce
|
|||
|
||||
val deployment = config.withFallback(default)
|
||||
|
||||
val routees = deployment.getStringList("routees.paths").asScala.toSeq
|
||||
val routees = Vector() ++ deployment.getStringList("routees.paths").asScala
|
||||
|
||||
val nrOfInstances = deployment.getInt("nr-of-instances")
|
||||
|
||||
|
|
|
|||
|
|
@ -4,6 +4,8 @@
|
|||
|
||||
package akka.remote
|
||||
|
||||
import language.existentials
|
||||
|
||||
import akka.remote.RemoteProtocol._
|
||||
import com.google.protobuf.ByteString
|
||||
import akka.actor.ExtendedActorSystem
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ private[akka] class RemoteDeployer(_settings: ActorSystem.Settings, _pm: Dynamic
|
|||
case AddressFromURIString(r) ⇒ Some(deploy.copy(scope = RemoteScope(r)))
|
||||
case str ⇒
|
||||
if (!str.isEmpty) throw new ConfigurationException("unparseable remote node name " + str)
|
||||
val nodes = deploy.config.getStringList("target.nodes").asScala map (AddressFromURIString(_))
|
||||
val nodes = deploy.config.getStringList("target.nodes").asScala.toIndexedSeq map (AddressFromURIString(_))
|
||||
if (nodes.isEmpty || deploy.routerConfig == NoRouter) d
|
||||
else Some(deploy.copy(routerConfig = RemoteRouterConfig(deploy.routerConfig, nodes)))
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ case class RemoteClientError(
|
|||
@transient @BeanProperty remote: RemoteTransport,
|
||||
@BeanProperty remoteAddress: Address) extends RemoteClientLifeCycleEvent {
|
||||
override def logLevel: Logging.LogLevel = Logging.ErrorLevel
|
||||
override def toString: String = "RemoteClientError@" + remoteAddress + ": Error[" + cause + "]"
|
||||
override def toString: String = "RemoteClientError@" + remoteAddress + ": Error[" + Logging.stackTraceFor(cause) + "]"
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -6,23 +6,13 @@ package akka.serialization
|
|||
|
||||
import java.io.Serializable
|
||||
import com.google.protobuf.ByteString
|
||||
import com.typesafe.config.Config
|
||||
import com.typesafe.config.ConfigFactory
|
||||
import akka.actor.Actor
|
||||
import akka.actor.ActorRef
|
||||
import akka.actor.Deploy
|
||||
import akka.actor.ExtendedActorSystem
|
||||
import akka.actor.NoScopeGiven
|
||||
import akka.actor.Props
|
||||
import akka.actor.Scope
|
||||
import com.typesafe.config.{ Config, ConfigFactory }
|
||||
import akka.actor.{ Actor, ActorRef, Deploy, ExtendedActorSystem, NoScopeGiven, Props, Scope }
|
||||
import akka.remote.DaemonMsgCreate
|
||||
import akka.remote.RemoteProtocol.ActorRefProtocol
|
||||
import akka.remote.RemoteProtocol.DaemonMsgCreateProtocol
|
||||
import akka.remote.RemoteProtocol.DeployProtocol
|
||||
import akka.remote.RemoteProtocol.PropsProtocol
|
||||
import akka.routing.NoRouter
|
||||
import akka.routing.RouterConfig
|
||||
import akka.remote.RemoteProtocol.{ DaemonMsgCreateProtocol, DeployProtocol, PropsProtocol }
|
||||
import akka.routing.{ NoRouter, RouterConfig }
|
||||
import akka.actor.FromClassCreator
|
||||
import scala.reflect.ClassTag
|
||||
|
||||
/**
|
||||
* Serializes akka's internal DaemonMsgCreate using protobuf
|
||||
|
|
@ -99,7 +89,7 @@ private[akka] class DaemonMsgCreateSerializer(val system: ExtendedActorSystem) e
|
|||
def props = {
|
||||
val creator =
|
||||
if (proto.getProps.hasFromClassCreator) {
|
||||
system.dynamicAccess.getClassFor(proto.getProps.getFromClassCreator) match {
|
||||
system.dynamicAccess.getClassFor[Actor](proto.getProps.getFromClassCreator) match {
|
||||
case Right(clazz) ⇒ FromClassCreator(clazz)
|
||||
case Left(e) ⇒ throw e
|
||||
}
|
||||
|
|
@ -134,9 +124,8 @@ private[akka] class DaemonMsgCreateSerializer(val system: ExtendedActorSystem) e
|
|||
protected def deserialize[T: ClassTag](data: ByteString, clazz: Class[T]): T = {
|
||||
val bytes = data.toByteArray
|
||||
serialization.deserialize(bytes, clazz) match {
|
||||
case Right(x) if classManifest[T].erasure.isInstance(x) ⇒ x.asInstanceOf[T]
|
||||
case Right(other) ⇒ throw new IllegalArgumentException("Can't deserialize to [%s], got [%s]".
|
||||
format(clazz.getName, other))
|
||||
case Right(x: T) ⇒ x
|
||||
case Right(other) ⇒ throw new IllegalArgumentException("Can't deserialize to [%s], got [%s]".format(clazz.getName, other))
|
||||
case Left(e) ⇒
|
||||
// Fallback to the java serializer, because some interfaces don't implement java.io.Serializable,
|
||||
// but the impl instance does. This could be optimized by adding java serializers in reference.conf:
|
||||
|
|
@ -144,8 +133,8 @@ private[akka] class DaemonMsgCreateSerializer(val system: ExtendedActorSystem) e
|
|||
// akka.routing.RouterConfig
|
||||
// akka.actor.Scope
|
||||
serialization.deserialize(bytes, classOf[java.io.Serializable]) match {
|
||||
case Right(x) if classManifest[T].erasure.isInstance(x) ⇒ x.asInstanceOf[T]
|
||||
case _ ⇒ throw e // the first exception
|
||||
case Right(x: T) ⇒ x
|
||||
case _ ⇒ throw e // the first exception
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,6 +3,8 @@
|
|||
*/
|
||||
package akka.remote
|
||||
|
||||
import language.postfixOps
|
||||
|
||||
import akka.testkit.AkkaSpec
|
||||
import akka.actor.ExtendedActorSystem
|
||||
import akka.util.duration._
|
||||
|
|
|
|||
|
|
@ -3,6 +3,8 @@
|
|||
*/
|
||||
package akka.remote
|
||||
|
||||
import language.postfixOps
|
||||
|
||||
import akka.testkit._
|
||||
import akka.actor._
|
||||
import com.typesafe.config._
|
||||
|
|
|
|||
|
|
@ -4,20 +4,14 @@
|
|||
|
||||
package akka.serialization
|
||||
|
||||
import language.postfixOps
|
||||
|
||||
import com.typesafe.config.ConfigFactory
|
||||
import akka.testkit.AkkaSpec
|
||||
import akka.actor.Actor
|
||||
import akka.actor.Address
|
||||
import akka.actor.Props
|
||||
import akka.actor.Deploy
|
||||
import akka.actor.OneForOneStrategy
|
||||
import akka.actor.SupervisorStrategy
|
||||
import akka.remote.DaemonMsgCreate
|
||||
import akka.remote.RemoteScope
|
||||
import akka.routing.RoundRobinRouter
|
||||
import akka.routing.FromConfig
|
||||
import akka.actor.{ Actor, Address, Props, Deploy, OneForOneStrategy, SupervisorStrategy, FromClassCreator }
|
||||
import akka.remote.{ DaemonMsgCreate, RemoteScope }
|
||||
import akka.routing.{ RoundRobinRouter, FromConfig }
|
||||
import akka.util.duration._
|
||||
import akka.actor.FromClassCreator
|
||||
|
||||
object DaemonMsgCreateSerializerSpec {
|
||||
class MyActor extends Actor {
|
||||
|
|
@ -92,6 +86,7 @@ class DaemonMsgCreateSerializerSpec extends AkkaSpec {
|
|||
ser.deserialize(bytes.asInstanceOf[Array[Byte]], classOf[DaemonMsgCreate]) match {
|
||||
case Left(exception) ⇒ fail(exception)
|
||||
case Right(m: DaemonMsgCreate) ⇒ assertDaemonMsgCreate(msg, m)
|
||||
case other ⇒ throw new MatchError(other)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue