Re: Hessian call with timeout

From: ejf <sun_king@xxx.net>
Date: Tue Feb 01 2005 - 22:49:06 PST

there's a Hessian-centric method with a Thread.sleep() at the end
that method is run inside of the inner Runnable inside of the
"runYourMethod()" ...

public yourMethod() throws InterruptedException, YourExceptionClasses{
int timeout=30;
HessianProxyFactory factory = new HessianProxyFactory();
MyService myservice = (MyService) factory.create(MyService.class,
url,timeout);
myservice.mymethod(param1,param2);
....
....
 
         Thread.sleep(3000);

}

public void runYourMethod(){
    yourMethod();

Runnable runMe = new Runnable() {
        public void run() {
            try{
            yourMethod();
            }catch(InterruptedException ie){}
            catch(YourExceptionClasses e){
            dostuff...
            }
        }
};
}

Jerónimo López Bezanilla wrote:

>Hello all,
>
>It's a simple question about timeouts with Hessian services
>
>I've a service implementation that sometimes spend a lot of time
>running and I want in my client code to get a exception (timeout) if
>the execution time is grater than n seconds.
>
>Is there any way to tell to the HessianProxy or HessianFactory a timeout??
>
>something like that:
>
>public method() throws Throwable {
>int timeout=30;
>HessianProxyFactory factory = new HessianProxyFactory();
>MyService myservice = (MyService) factory.create(MyService.class, url,timeout);
>myservice.mymethod(param1,param2);
>....
>....
>
>}
>
>if in 30 seconds, mymethod doesn't end, get an exception and later catch it.
>
>Thanx
>
>
>
>
Received on Tue 01 Feb 2005 22:49:06 -0800

This archive was generated by hypermail 2.1.8 : Thu Sep 28 2006 - 20:16:40 PDT