Hi 

did you manage to run this code sample? I'm on version 2.11:2.4.7 and I 
can't figure out how to configure MultiNode config for Java. 


Best
SM



W dniu poniedziałek, 22 września 2014 06:28:01 UTC+2 użytkownik jen napisał:
>
> I tried  translate to Java of the existing Scala codes:
>
> public class ClusterTest {
>
>     protected RoleName first;
>
>     @Test
>     public void SimpleClusterListenerClusterJoinTest() throws Exception {
>         new MultiNodeSpec(new MultiNodeConfig() {{
>             first = this.role("first");
>             second = this.role("second");
>             third = this.role("third");
>             this.commonConfig(ConfigFactory.parseString(
>                 "akka.crdt.convergent.leveldb.destroy-on-shutdown = on\n" +
>                     "akka.actor.provider = 
> akka.cluster.ClusterActorRefProvider\n" +
>                 "akka.cluster.auto-join = off\n" +
>                 "akka.cluster.auto-down = on\n" +
>                 "akka.loggers = [\"akka.testkit.TestEventListener\"]\n" +
>                 "akka.loglevel = INFO\n" +
>                 "akka.remote.log-remote-lifecycle-events = off")); }}) {
>                     {
>                         Address firstAddress = node(first).address();
>                         @SuppressWarnings("serial")
>                         ArrayList<RoleName> firstnode = new 
> ArrayList<RoleName>() {{
>                         add(first);
>                         }};
>                         Seq<RoleName> fisrtnodeseq = 
> (Seq<RoleName>)JavaConversions.asScalaBuffer(firstnode).toList();             
>          
>                         runOn(fisrtnodeseq, null);
>
>                 Cluster cluster = new Cluster((ExtendedActorSystem) system());
>                 cluster.join(firstAddress);
>                 // verify that single node becomes member
>                 cluster.subscribe(testActor(), MemberEvent.class);
>                 expectMsg(MemberUp.class);
>                     }
>
>                     @Override
>                     public int initialParticipants() {
>                         return roles().size();
>                     }};
>
>     }
>
> }
>
> HOWEVER During the run with the arguments: -Dmultinode.max-nodes=4 
> -Dmultinode.host=127.0.0.1 etc. according to Multi Node Testing 
> <http://doc.akka.io/docs/akka/snapshot/dev/multi-node-testing.html> I 
> will get the following error:
>
> java.lang.IllegalArgumentException: invalid ActorSystem name [ClusterTest_2], 
> must contain only word characters (i.e. [a-zA-Z0-9] plus non-leading '-')
> at akka.actor.ActorSystemImpl.<init>(ActorSystem.scala:497)
> at akka.actor.ActorSystem$.apply(ActorSystem.scala:141)
> at akka.actor.ActorSystem$.apply(ActorSystem.scala:118)
> at akka.remote.testkit.MultiNodeSpec.<init>(MultiNodeSpec.scala:252)
> at com.akkamint.demo.ClusterTest$2.<init>(ClusterTest.java:51)
>
> is the internally generated ActorSystem name wrong?
>
> Besides this I have two questions:
> 1. How can access the gossips from Java as in the Scala code,
>
> awaitCond(Cluster(system).latestGossip.members.exists(m ⇒ m.address == 
> firstAddress && m.status == Up))
>
> as I have not found any way to implement the same in Java. My workaround 
> is to subscribe to member events (see above), otherwise I do not know, is 
> if this effectively the same or not?
> 2. Thunk function (the second argument of runOn method)? What is that? How 
> can use it?
>
> I appreciate your help.
>
>
>

-- 
>>>>>>>>>>      Read the docs: http://akka.io/docs/
>>>>>>>>>>      Check the FAQ: 
>>>>>>>>>> http://doc.akka.io/docs/akka/current/additional/faq.html
>>>>>>>>>>      Search the archives: https://groups.google.com/group/akka-user
--- 
You received this message because you are subscribed to the Google Groups "Akka 
User List" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.

Reply via email to