Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Two questions

 
David Khoi Pham
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello!

I have two questions I have struggled to find a solution to.

My first question is what is needed for code to enter a synchronized block? I'm trying to debug my lock method and it seems whenever I call the lock method, my code enters the method, but doesn't enter the synchronized block.

My second question is how can I take an ip address given to me, try to connect to it with rmi, and if I can't connect to it in a certain amount of time, timeout and give an error message?

Thanks!
David Pham
[ August 21, 2007: Message edited by: David Khoi Pham ]
 
Javier Corral
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I believe that if the synchronized code is never executed, it means that in some place you have a lock which is needed to release, otherwise at least once the synchronized code would run.


When you call Naming.lookup("rmi://...IP.../rmi_object") in the client side, you can specify the IP. I think if the client can't connect to the remote object you'll get a RemoteException, but I don't know how long is the time out specified.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic