Solved

Asymetric behaviour in method call.

Posted on 2013-01-07
4
303 Views
Last Modified: 2013-01-08
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.
0
Comment
Question by:krakatoa
  • 3
4 Comments
 
LVL 26

Accepted Solution

by:
dpearson earned 500 total points
ID: 38753704
I don't think you should expect a general solution for this - you need to post some of the details of the method that is being called so we can try to figure out why it's returning an empty object.  

There's lots of possible reasons (bugs) that can cause this sort of thing...
0
 
LVL 16

Author Comment

by:krakatoa
ID: 38753833
You are quite right Doug. Ironically, that's why I didn't post any code - there's too much, but I thought it was worth a stab asking generally, as after all I didn't have another clue. But I'm going to take a look at one particular area right now, and if that produces nothing, I'll get back with smthg here.
0
 
LVL 16

Author Comment

by:krakatoa
ID: 38754462
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 :

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();}

						} 

Open in new window


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);
			}

Open in new window

0
 
LVL 16

Author Comment

by:krakatoa
ID: 38756874
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. ;)
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:

910 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now