Add possibility to configure an actor in 'actorOf' by passing in an Props
Something like:
Where:
Should be possible to do:
If config in akka.conf exists for the same 'address' then it should override this programmatic config.
actorOf[TYPE]("address", Props(shared, Deploy(...), other))
Where:
- shared - boolean - see ticket #994
- Deploy - is the standard programmatic deployment config found in 'DeploymentConfig._'
- other - is potential other config stuff
Should be possible to do:
implicit val config = Props(shared, Deploy(...), other) actorOf[TYPE]("address")
If config in akka.conf exists for the same 'address' then it should override this programmatic config.
Leave a comment
Depending on how it is done, it could also lead to a size reduction in the local actor ref since instead of having a reference to all dependencies individually, it can point to a 'config' object that contains all dependencies for this family for actors. So if 3 object-fields can be merged into a single shared reference, than the object size has been reduced by 64 or 128 bits (depending if a 64 bits pointers are used or 32).
Of course, it is important on the call site to make sure that the config-reference is stored somewhere (else the memory size increases).
class Foo{
val config = new ActorConfig(someMailbox, someOtherStuff)
def foo(){
val actor = Actor.actorOf(config)
...
}
}
It will cause more pain on the memory bus because of the indirection, but I don't think it will make a big difference in Akka since already so much indirection is going on.
Another advantage is that there is less pressure on the gc since less litter (config objects) are created.
Of course, it is important on the call site to make sure that the config-reference is stored somewhere (else the memory size increases).
class Foo{
val config = new ActorConfig(someMailbox, someOtherStuff)
def foo(){
val actor = Actor.actorOf(config)
...
}
}
It will cause more pain on the memory bus because of the indirection, but I don't think it will make a big difference in Akka since already so much indirection is going on.
Another advantage is that there is less pressure on the gc since less litter (config objects) are created.
on 2011-07-19 02:41 *
By viktorklang
Assigned to changed from viktorklang to -none-
Priority changed from Normal (3) to Highest (1)
on 2011-08-16 11:50 *
By viktorklang
Props has been created. I'm conducting my work in the "wip-props"-branch
I've converted TypedActor
I've added a SelfActorRef that will be the type of "self" inside an actor,
here I'll move things that do not make sense outside of the Actor instance like:
hotswap
reply
channel
etc
I've converted TypedActor
I've added a SelfActorRef that will be the type of "self" inside an actor,
here I'll move things that do not make sense outside of the Actor instance like:
hotswap
reply
channel
etc
on 2011-09-06 02:17 *
By viktorklang
Description changed from Something like:
acto... to Something like:
acto...
Summary changed from Add possibility to configure an actor in 'actorOf' by passing in an ActorConfiguration to Add possibility to configure an actor in 'actorOf' by passing in an Props
Not exactly what this ticket said, the deployment config should be in config file only.