Fixed several memory and thread leaks. See #1404

* Dispatchers need Scheduler to be able to shutdown themselves. Stop Scheduler after dispatchers.
* Changed CallingThreadDispatcher global object to Extension, since it holds map of references to mailboxes. Will be GC:ed when system is GC:ed.
* Made testActor lazy, since it is not used in all tests, and it creates CallingThreadDispatcher.
* Activated some java tests that were not running
* Many tests were not stopping created ActorSystems. VERY IMPORTANT TO STOP ActorSystem in tests. Use AkkaSpec as much as possible.
* Used profiler to verify (and find) dangling ActorSystemImpl and threads from dispatchers.
* FutureSpec creates ForkJoinPool threads that are not cleared, but number of threads don't grow so it's not a problem.
This commit is contained in:
Patrik Nordwall 2011-11-30 15:16:20 +01:00
parent 035f514843
commit b488d70f54
31 changed files with 232 additions and 105 deletions

View file

@ -1,5 +1,8 @@
package akka.stm.example;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import akka.actor.ActorSystem;
import akka.stm.*;
import akka.actor.*;
@ -7,11 +10,8 @@ import akka.testkit.AkkaSpec;
public class RetryExample {
public static void main(String[] args) {
System.out.println();
System.out.println("Retry example");
System.out.println();
ActorSystem application = ActorSystem.create("RetryExample", AkkaSpec.testConf());
ActorSystem application = ActorSystem.create("RetryExample", AkkaSpec.testConf());
final Ref<Double> account1 = new Ref<Double>(100.0);
final Ref<Double> account2 = new Ref<Double>(100.0);
@ -47,5 +47,7 @@ public class RetryExample {
// Account 2: 600.0
transferer.stop();
application.stop();
}
}