Modularize configuration. See #1361
* Split config reference to one for each module/extension. * Adjusted signature of registerExtension to avoid race of extension init * Moved Duration.dilated to testkit * TestKitExtension * RemoteExtension * SerializationExtension * Durable mailboxes extensions * Fixed broken serialization bindings and added test * Updated configuration documentation * System properties akka.remote.hostname akka.remote.port replaced with akka.remote.server.hostname and akka.remote.server.port * Adjustments of ActorSystem initialization. Still don't like the two-phase constructor/init flow. Very fragile for changes. Review fixes. SerializationExtension
This commit is contained in:
parent
c56341b3a6
commit
179399296e
85 changed files with 1233 additions and 643 deletions
|
|
@ -12,29 +12,34 @@ import com.typesafe.config.ConfigParseOptions;
|
|||
import static org.junit.Assert.*;
|
||||
|
||||
public class JavaExtension {
|
||||
|
||||
|
||||
static class TestExtension implements Extension<TestExtension> {
|
||||
private ActorSystemImpl system;
|
||||
public static ExtensionKey<TestExtension> key = new ExtensionKey<TestExtension>() {};
|
||||
|
||||
public ExtensionKey<TestExtension> init(ActorSystemImpl system) {
|
||||
this.system = system;
|
||||
public static ExtensionKey<TestExtension> key = new ExtensionKey<TestExtension>() {
|
||||
};
|
||||
|
||||
public ExtensionKey<TestExtension> key() {
|
||||
return key;
|
||||
}
|
||||
|
||||
|
||||
public void init(ActorSystemImpl system) {
|
||||
this.system = system;
|
||||
}
|
||||
|
||||
public ActorSystemImpl getSystem() {
|
||||
return system;
|
||||
}
|
||||
}
|
||||
|
||||
private Config c = ConfigFactory.parseString("akka.extensions = [ \"akka.actor.JavaExtension$TestExtension\" ]", ConfigParseOptions.defaults());
|
||||
|
||||
private Config c = ConfigFactory.parseString("akka.extensions = [ \"akka.actor.JavaExtension$TestExtension\" ]",
|
||||
ConfigParseOptions.defaults());
|
||||
|
||||
private ActorSystem system = ActorSystem.create("JavaExtension", c);
|
||||
|
||||
|
||||
@Test
|
||||
public void mustBeAccessible() {
|
||||
final ActorSystemImpl s = system.extension(TestExtension.key).getSystem();
|
||||
assertSame(s, system);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue