| Author |
Message |
|
| adamprisa |
Posted: Mon Jan 19, 2009 3:08 pm |
|
|
|
Joined: 21 Nov 2008
Posts: 7
|
I want to create two processes Process1 and Process2 each of these should have one mailbox each.
Code: public class Process1
{
public static void main(String[] args) throws IOException
{
OtpNode oNode = new OtpNode("jnode2");
oNode.setCookie("abc");
OtpMbox mbox1 = oNode.createMbox("process1");
...
while (true)
{
try
{
System.out.println("before receive..");
receivedObject1 = mbox1.receive();
System.out.println("after receive..");
...
}catch(Exception e){}
}
}
}
}
and similarly Process2
Code: public class Process2
{
public static void main(String[] args) throws IOException
{
OtpNode oNode = new OtpNode("jnode2");
oNode.setCookie("abc");
OtpMbox mbox1 = oNode.createMbox("process2");
...
while (true)
{
try
{
System.out.println("before receive..");
receivedObject2 = mbox1.receive();
System.out.println("after receive..");
...
}catch(Exception e){}
}
}
}
}
I am not able to call these processes individually using a client
Code: mbox.send("process1", "jnode2@host-machine", tuple);
mbox2.send("process2", "jnode2@host-machine", tuple);
For me only one process(whichever is started first) is working.
Help highly appreciated. The entire code files are attached along with. |
| Description: |
Files Attached:
Process1.java Process2.java EchoClient.java |
|
 Download |
| Filename: |
Files.zip |
| Filesize: |
2.1 KB |
| Downloaded: |
888 Time(s) |
|
|
| Back to top |
|
| Mazen |
Posted: Mon Jan 19, 2009 3:26 pm |
|
|
|
User
Joined: 20 Jul 2006
Posts: 164
Location: London
|
Try creating otp nodes with different names. I suspect there is a clash there.
/M |
|
|
|
| Back to top |
|
| adamprisa |
Posted: Tue Jan 20, 2009 5:24 am |
|
|
|
Joined: 21 Nov 2008
Posts: 7
|
| I do not want to create OTP Nodes with different names. I want to have the node names same. |
|
|
|
| Back to top |
|
| Mazen |
Posted: Tue Jan 20, 2009 1:30 pm |
|
|
|
User
Joined: 20 Jul 2006
Posts: 164
Location: London
|
you can't have 2 nodes with the same -sname or -name AFAIK. Try it in the shell you will see.
run:
twice
I mean how else would you know to which of the two nodes a message should be sent to? probably the second node fails to start and all messages go to the first (which is pretty logical). |
|
|
|
| Back to top |
|
| adamprisa |
Posted: Thu Jan 22, 2009 9:30 am |
|
|
|
Joined: 21 Nov 2008
Posts: 7
|
Quote: I do not want to create OTP Nodes with different names. I want to have the node names same.
Thats what i am saying. I want to have nodes with he same name. but mailboxes with different names. |
|
|
|
| Back to top |
|
| Matrim |
Posted: Fri Jan 23, 2009 4:16 pm |
|
|
|
Joined: 13 Jan 2009
Posts: 4
|
adamprisa wrote: Thats what i am saying. I want to have nodes with he same name. but mailboxes with different names. You would have to create two mailboxes in Java:
Code: OtpMbox mbox1 = new OtpMbox("process1");
OtpMbox mbox2 = new OtpMbox("process2");
Making them concurrent is where the problem lies. You may have to use Java threads to do that, which would be a pain. (i.e., create a wrapper class that implements Runnable [I think]... constructor takes mailbox name as a parameter.) |
|
|
|
| Back to top |
|
|
|