开发者

Abort RemoteObject call

Is it possible to abort a flex remoteObject call? I tried the below method but the http request is still loading in the background:

var r:RemoteObject = new RemoteObject('<myDestination>');
r.source('myClass');
r.myMethod.addEventListener(ResultEvent.RESULT, myResponse);

r.myMethod(); // lets say this method takes 5 second to call

r.channelSet.disconne开发者_JAVA百科ctAll(); // I thought this would abort the actual HTTP request but its still running

EDIT

The thing I'm interested in is freeing up the browsers HTTP Pipeline, just like in javascript where you can use abort on the XHR.


you can try cancel() method of AbstractOperation.

r.getOperation("OperationName").cancel();

UPDATE:

This is the problem, I invoke a large call then the user leaves the view so I don't need to wait for the response anymore. Right now the http request is blocking any further requests. Got any solution for this?

you should make another operation in your server side service to stop current service. then when you need to abort the current running service, cancel the operation (on flex) then call the stop service by calling stop service from flex side.

to stop current running thread on server side, depends on what server side you used.


Note that by Operation cancel it will only influence the Flex client - your responders are never going to be invoked. On the server side there the request is running normally (consuming resources until the end), and you'll have to write some custom code in order to prevent that.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜