axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Toshiyuki Kimura <to...@apache.org>
Subject Re: Abort a call
Date Sat, 20 Sep 2003 05:18:46 GMT
Hi Josh,

  It seems your approach is a creation of your
specific 'Provider' for the cancelable service.
However - actually, is it necessary ?

  The snippet might be used as a kind of solution
for a sync web service. But, why don't you use the
existing mechanism - Session, EBB transaction ...

Ugh, Steve gives a comment in this thread, have to
check ...

On Fri, 19 Cep 2003, Josh Reh man wrote:

> Slimane Amar wrote:
> > Hi Toshi,
> >
> > No, i want really cancel the invoked service
> >
> > within a blocking architecture (synchonous call RPC).
> >
> >
> >
> > Is it possible ?
>
>
> I think this is possible, but it depends mostly on the server
> implementation.
>
> Consider a service with the following interface:
>
> int doRequest();
>
> void stopRequest(int requestId);
>
>
> The client might do something like this:
>
> service.setTimeout(4000);
> int id = service.doRequest();
>
> if (timedOut){
>    service.stopRequest(id);
> }
>
>
> On the server, you might have something like this:
>
> Service{
>
> static int requestId;
> static Map requestToProcessMap;
>
> //assign id, make process, start process
> int doRequest() throws RemoteException {
>    int id = ++requestId;
>    Process p= new Process();
>    requestToProcessMap.put(id,p);
>    p.start(); //spins a thread
>    return ++requestId;
> }
>
> void stopRequest(int requestId) {
>    Process p = requestToProcessMap.get(requestId);
>    p.requestStop();
> }
>
> }
>
>
> Process {
>    boolean pleaseStop = false;
>
>    void start() {
>       boolean hasMore = true;
>       while (!pleaseStop && hasMore){
>          hasMore = doSomething();
>       }
>    }
>
>    void reqestStop() {
>      pleaseStop = true;
>    }
>
>    void doSomething() {
>
>    }
> }
>
>
> This is a classic threading problem at a certain point. The only
> relationship to axis is the inclusion of a symmetric service that
> stops a service that has already been started. Note the requirement
> to reference another process with an id.
>
> None of this will work if "doSomething()" only returns once, that is,
> when it's done. Sometimes long running processes can be broken up into
> peices and executed linearly. But sometimes, like when you're waiting
> for a database result, you can't do much of anything to free up those
> database resources. We've had that problem with Oracle: it offers no API
> like the one I'm describing here, which is too bad. It happily
> calculates results and then finds a broken pipe and throws the results
> away. So wasteful!
>
> Note also that in the case above no results are returned from the work.
> This is probably unrealistic. I leave it to the reader to fix that
> problem...mainly it involves having the doRequest method return
> immediately, and then having the client check for results with a second
> call.
>
> HTH,
> Josh Rehman

Mime
View raw message