Hi,
In one of my previous posts I told I have a problem using my Java ORB. The code looks as:
import org.omg.CosNaming.*;
import org.omg.CORBA.*;
public class __main__ {
public static String __argomenti__ [] = new String[2];
public static void main(String args[]){
try{
int __count__;
char[] __buffer__ = new char[1024];
String __temp__ = "";
String __temp1__ = "";
java.io.FileReader rd = new java.io.FileReader("Config1.txt"
while ((__count__ = rd.read(__buffer__, 0, 1024)) != -1)
{
__temp__ = new String(__buffer__, 0, __count__);
__temp1__ = __temp1__ + __temp__;
}
rd.close();
__argomenti__[0] = "-ORBInitialHost";
__argomenti__[1] = __temp1__.trim();
ORB orb = ORB.init(__argomenti__,null);
org.omg.CORBA.Object objRef = orb.resolve_initial_references("NameService"
NamingContext ncRef = NamingContextHelper.narrow(objRef);
contatoreServant c;
NameComponent nc = new NameComponent("contatore", "ogg1"
NameComponent pathc[] = {nc};
contatoreServant d;
NameComponent nd = new NameComponent("contatore", "ogg2"
NameComponent pathd[] = {nd};
c = new contatoreServant ( new String2("User1" );
contatore contatoreServantRefogg1 = new _contatoreTie(c);
orb.connect(contatoreServantRefogg1);
ncRef.rebind(pathc, contatoreServantRefogg1);
d = new contatoreServant ( new String2("User2" );
contatore contatoreServantRefogg2 = new _contatoreTie(d);
orb.connect(contatoreServantRefogg2);
ncRef.rebind(pathd, contatoreServantRefogg2);
java.lang.Object sync = new java.lang.Object();
synchronized(sync){sync.wait();}
}
catch(Exception e)
{
System.out.println(e.toString());
}
}
} // end __main__ class
When a client uses an object of type contatore the ORB uses only the first one connected to reply (in this example the one identified by "c" to the request..
Is there a way to solve this problem without making many changes or I have to think of another solution?
Thanks,
Marco
PS To Calahan: Thanks for your reply, how would you adapt your bank example to this ? The interface of "contatore" doesn't matter at all..
In one of my previous posts I told I have a problem using my Java ORB. The code looks as:
import org.omg.CosNaming.*;
import org.omg.CORBA.*;
public class __main__ {
public static String __argomenti__ [] = new String[2];
public static void main(String args[]){
try{
int __count__;
char[] __buffer__ = new char[1024];
String __temp__ = "";
String __temp1__ = "";
java.io.FileReader rd = new java.io.FileReader("Config1.txt"
while ((__count__ = rd.read(__buffer__, 0, 1024)) != -1)
{
__temp__ = new String(__buffer__, 0, __count__);
__temp1__ = __temp1__ + __temp__;
}
rd.close();
__argomenti__[0] = "-ORBInitialHost";
__argomenti__[1] = __temp1__.trim();
ORB orb = ORB.init(__argomenti__,null);
org.omg.CORBA.Object objRef = orb.resolve_initial_references("NameService"
NamingContext ncRef = NamingContextHelper.narrow(objRef);
contatoreServant c;
NameComponent nc = new NameComponent("contatore", "ogg1"
NameComponent pathc[] = {nc};
contatoreServant d;
NameComponent nd = new NameComponent("contatore", "ogg2"
NameComponent pathd[] = {nd};
c = new contatoreServant ( new String2("User1" );
contatore contatoreServantRefogg1 = new _contatoreTie(c);
orb.connect(contatoreServantRefogg1);
ncRef.rebind(pathc, contatoreServantRefogg1);
d = new contatoreServant ( new String2("User2" );
contatore contatoreServantRefogg2 = new _contatoreTie(d);
orb.connect(contatoreServantRefogg2);
ncRef.rebind(pathd, contatoreServantRefogg2);
java.lang.Object sync = new java.lang.Object();
synchronized(sync){sync.wait();}
}
catch(Exception e)
{
System.out.println(e.toString());
}
}
} // end __main__ class
When a client uses an object of type contatore the ORB uses only the first one connected to reply (in this example the one identified by "c" to the request..
Is there a way to solve this problem without making many changes or I have to think of another solution?
Thanks,
Marco
PS To Calahan: Thanks for your reply, how would you adapt your bank example to this ? The interface of "contatore" doesn't matter at all..