Bethibande / actors

A actor framework and KSP processor/generator for kotlin.
Apache License 2.0
2 stars 0 forks source link

Store actors in ActorSystem #18

Closed Bethibande closed 5 months ago

Bethibande commented 5 months ago

Task

Motivation

The ActorSystem needs to store a reference to all actors it created, until they are closed. Currently it is possible to create two actors with the same id, possibly allowing two instances of the same actor to exist at the same time. In order to fix this the ActorSystem will need to have a list of map of all the actors it created and their ids. This will allow the ActorSystem to just return an existing instance if an actor with an existing id is created.

Bethibande commented 5 months ago

Done, if an id is specified when creating an actor and the id is already in use, the LocalActorSystem will now throw a IllegalStateException. In order to prevent random exceptions, there now is a exists(ActorId) function.