• Post Reply Bookmark Topic Watch Topic
  • New Topic

How can i check the content of a local variable periodically  RSS feed

 
Sumayah Abdul
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello everyone,

I'm using RMI to create remote objects. one of these objects (e.g. ObjectA) receives requests from other users and propagates them to others (e.g ObjectB& ObjectC). When ObjectA receives replies from ObjectB & ObjectC, a response is sent back to the requesting user.
the replies of ObjectB & ObjectC are not performed as a return value of the recieveRequest function but rather a separate function call to a function in ObjectA.

The problem is that I need to timeout these requests in order to return a request failure to the user.
I will need ObjectA to record the time of recieving the request and periodically check it against the timeout period.
My question is, is there any way to do this other than using Threads? Also, will it degrade the performance?

Your Help is greatly appreciated.
Thank you..

 
Martijn Verburg
author
Bartender
Posts: 3275
5
Eclipse IDE Java Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Using threads is probably the best way to go here, I can't think of another clean option.
 
Rob Spoor
Sheriff
Posts: 21133
87
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
java.util.Timer comes to mind. That uses a Thread in the background but makes it easier for you to schedule when that thread should run.

Don't forget to include proper synchronization.
 
Sumayah Abdul
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you for replying. I will.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!