krakatoa
asked on
Asymetric behaviour in method call.
The client makes a method call, which returns fine, with the data (object), and the programme runs. The pre-method call status is supposed to be restored when its business is finished, so that a different client can run the same routine. This time, the method appears to return an empty object, and I can't see why. The clients establish a direct UDP connection with each other via a primary TCP association. It's this TCP linkup routine that is failing. Anyone want to try to help throw some light on what may be happening? Thanks.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
It's a mystery to say the least. A client speaks to its server instance to fetch an object. It returns ok. That client can do that operation as often as. But (in say just a 2-client scenario) the other client, when it tries to do the same thing, receives an empty object. The clients are on separate machines, and each has a one-to-one with its server instance.
In the server instance, I've put in a line to print to screen the particular client's credentials. These get printed, therefore a call from either client is at least getting this far. This is the code in the server instance :
And this is the code in a calling client, asking for the object :
In the server instance, I've put in a line to print to screen the particular client's credentials. These get printed, therefore a call from either client is at least getting this far. This is the code in the server instance :
protocol = BR_voxinitreader.readLine().trim();
if ("RNG".equals(protocol)) {
try {
iamcaller = true;
oos.flush();
System.out.println(myclientsInetAddress);
oos.writeObject(PersephonepS.phoneDirectory);
} catch (Exception exceptsock) {exceptsock.printStackTrace();}
}
And this is the code in a calling client, asking for the object :
protected ConcurrentHashMap getPhoneDirectory(){ //remote class
Object ob =null;
try{
PW_voxiniwriter.println("RNG");
PW_voxiniwriter.flush();
ob=ois.readObject();
}catch(Exception oosex){}
return((ConcurrentHashMap)ob);
}
ASKER
You helped me think again about where the problem must be, since there is nothing wrong with the code, as I'm sure you know. ;) So your 'no comment' did the trick. I was erasing the object payload too early. It's fixed now.
But I'll be back with a couple of toughie questions again soon. ;)
But I'll be back with a couple of toughie questions again soon. ;)
ASKER