Solved

Interupting an RMI Method

Posted on 2006-06-28
5
224 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
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 400 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

ScreenConnect 6.0 Free Trial

Check out the updates in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI that improves session organization and overall user experience. See the enhancements for yourself!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
mockito example issue 8 73
eclipse java  build path 6 59
jboss wildfly 10.1 10 97
maven module vs maven project 3 23
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
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…
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.

803 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