?
Solved

Interupting an RMI Method

Posted on 2006-06-28
5
Medium Priority
?
237 Views
Last Modified: 2010-03-31
Hi,

I would just like to know if it is possible to interupt an RMI method.

Suppose ane Application call it 'A' had to invoke an RMI method in an object hosted by another application say 'B' and the RMI method hosted by B had some code to the effect of "while(true)" or "for(;;;)".

Would it be possible for application A to interupt the RMI method or would the thread in A that invoked the method be blocked forever until application B terminated.

Thanks in advance for any suggestions.

0
Comment
Question by:mric5180
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 23

Expert Comment

by:Ajay-Singh
ID: 17007034
Try interrupting the thread that running RMI call.
0
 
LVL 35

Expert Comment

by:girionis
ID: 17007370
> would the thread in A that invoked the method be blocked forever until application B terminated.

It depends on where it is running. If application A is runnign on the main thread then it will be block and you won't have any chance to interrupt it. If it is running from *another* thread then you could add your own code to handle such functionallity.
0
 
LVL 8

Expert Comment

by:colr__
ID: 17007587
If A calles a method in B, then A shouldnt be able to continue until it has a satisfactory response from B (or at least, B returns). In the case where it is interrupted, that may not be the case and so your program could lose stability.

Does B return anything? Could it be run in a thread so that A simply calles the mehtod then continues with its own exectution?

colr__
0
 

Author Comment

by:mric5180
ID: 17014184
In response to colr's comment:

I'm not in control of both sides of the interface, another company is coding Application B, the one whichs hosts the RMI method so i have no control over what that method does.

What i am trying to do is mitigate the risk that the RMI method never returns. I already invoke the method in B from a seperate thread in Application A so as to allow the rest of the application to continue however should the method in B never return i'm stuck with a thread i don't want.

So what i really want to be able to do is interupt an RMI call if it is taking too long.
0
 
LVL 35

Accepted Solution

by:
girionis earned 1600 total points
ID: 17015891
You can make the thread exit or timeout after a specific amount of time, if method B never returns. Provide a method in your thread class that other objects can use it to ask it to stop running.
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

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

Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
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 how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
Suggested Courses

649 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