* 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.
20 lines
500 B
Java
20 lines
500 B
Java
/**
|
|
* Copyright (C) 2009-2011 Typesafe Inc. <http://www.typesafe.com>
|
|
*/
|
|
package akka.util;
|
|
|
|
import org.junit.Test;
|
|
|
|
public class JavaDuration {
|
|
|
|
@Test
|
|
public void testCreation() {
|
|
final Duration fivesec = Duration.create(5, "seconds");
|
|
final Duration threemillis = Duration.parse("3 millis");
|
|
final Duration diff = fivesec.minus(threemillis);
|
|
assert diff.lt(fivesec);
|
|
assert Duration.Zero().lteq(Duration.Inf());
|
|
assert Duration.Inf().gt(Duration.Zero().neg());
|
|
}
|
|
|
|
}
|