Solved

Interupting an RMI Method

Posted on 2006-06-28
5
220 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
5 Comments
 
LVL 23

Expert Comment

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

Expert Comment

by:girionis
Comment Utility
> 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__
Comment Utility
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
Comment Utility
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 400 total points
Comment Utility
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

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

For customizing the look of your lightweight component and making it look opaque like it was made of plastic.  This tip assumes your component to be of rectangular shape and completely opaque.   (CODE)
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.

728 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

15 Experts available now in Live!

Get 1:1 Help Now