flex responder default timeout value? - apache-flex

Does anyone knows whats the default timeout value for the responder object? is there a time limit when the flex app will wait for result and call fault handler instead of result handler?

Use the getter / setter to access the requestTimeOut property of your RemoteObject.
More info here: RemoteObject

First off... I would recommend setting a cfquery timeout in any cfc call (if you're using coldfusion). If the query times out then it will hit your fault.
Check out "requestTimeout" here
http://livedocs.adobe.com/flex/2/langref/mx/rpc/remoting/RemoteObject.html#propertySummary
You can also just create your own timer with a timer object
Once the timer reaches a certain point you can "disconnect" or "logout", and call the fault function manually
Let me know if this helps.

Related

return type for event in TinyOS

I'm implementing a module using nesC for TinyOS. My modules uses interface Timer<> so I have to implement the event fired of the interface Timer, it is possible to return a value inside this implementation or an event must be always void?
The return type of the Timer.fired event is defined as void and this cannot be changed. Even if the type was non-void, the returned value would be delivered to the component that signals the event, which is some system component implementing the Timer interface.
In order to get some hints on how to solve your problem, please provide more details explaining for what purpose you want to return a value from the fired event, that is, who is expected to get and process the returned value.

http service not working for parallel requests

I am using an http service object to make servlet requests inside a method in flex. The method is being invoked simultaneously in parallel by two events. I could see that both requests have reached the servlet, but only one returns to the result event. Also this behaviours is not consistent . is it possible that parallel invocation of the httpservice result in loss of some requests? I am sure that both requests have reached the servlet and data is returned from it. Its just that the result event is not triggered in certain cases.
Thanks in advance.
Including code to describe the issue better.
Please find the method below. The below method "callServlet" is being invoked by two separate events
private var httpObj:HTTPService=new HTTPService();
private function callServlet(text:String):void{
Alert.show(text);
httpObj = new HTTPService();
httpObj.url=<servlet URL>;
httpObj.method="POST";
httpObj.resultFormat="xml";
httpObj.contentType="application/xml";
var requestString:String=text;
httpObj.request=requestString;
httpObj.addEventListener(ResultEvent.RESULT,onResultMethods);
httpObj.addEventListener(FaultEvent.FAULT,onFaultMethod);
httpObj.send();
}
Each time i call the method, i pass a different "text" variable. I can see that the alert displays the two different texts send to it. And as explained earlier, both requests does reach the servlet and a response is sent from servlet.
But the result event "onResultMethod" is invoked just once.It doesnt invoke the "faultonFaultMethod" either.
Yes, I have seen this problem before, if you are making multiple requests from flex, some of them will be lost, that was back in 3.0 times. Browsers has a way of stopping the number of http calls, they can allow maximum of 2 calls at a time(depends on the browser), may be chain your requests one after the other or use a singleton which manages your calls.
Thanks all for help. I think i ve got the issue though i cannot guarantee the answer to be right.
The above method is called twice by two events. The httpOject variable is a private var global to the method callServlet. The listeners created in this method are being removed in the result and fault handler methods(this is not shown in the code above).
So i believe when multiple events call the method simultaneously there is a chance that the global variable httpObj is modified by both the events and hence both events result in servlet call using the same httpservice object. When the first call returns to the resulthandler i am removing the listener for resulthandler due to which the second result does not reach the resulthandler method.
This is my assumption and as of now i dont have any better solution. Do let me know if anyone comes up with a better explanation.

Webdriver: How to override get() method?

In webdriver, While opening a page
Webdriver.get("www.yahoo.com");
If an element I want to click appears instantly, unnecessarily I have to wait till the page load completes.
Is there any solution/suggestion to overcome this problem?
Thanks in Advance
In WebDriver there are three implicit waits
implicitlyWait
driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
pageLoadTimeout
driver.manage().timeouts().pageLoadTimeout(30, SECONDS);
setScriptTimeout
driver.manage().timeouts().setScriptTimeout(30,SECONDS);
You can specify the time in above methods to wait before throwing exception.
See this link for more information
In Default the Web driver instance will wait until the page load completes. But you can change the timeout duration using
//Assume driver instance is initialized properly
driver.manage().timeouts().pageLoadTimeout(5, TimeUnit.SECONDS);
If the page load exceeds the given duration mean it will throw the TimeOut Exception
For more info.
Try FluentWait, though this is for handling ajax element but may be useful for your case. here is the resource -
http://www.thoughtworks-studios.com/twist/2.3/help/how_do_i_handle_ajax_in_selenium2.html

Flex - how to abort/stop a RemoteObject method call?

I am using RemoteObjects to call ZendAMF PHP from Flex/Flash Builder 4.6. I want to stop or abort a method call before it sends the request to the server based on an event or similar.
I have a class where I create and store all the RemoteObjects - for example:
activityLogService = new RemoteObject("zend");
activityLogService.endpoint=endpointServer;
activityLogService.addEventListener(FaultEvent.FAULT,faultHandler);
Then later I can simply call this object:
remotingService.activityLogService .getRecords();
I am trying to find a way in my remotingService object to stop the request - and not send anything to the server - for example if some variables are not set properly.
I noticed there is an invoke event:
activityLogService.addEventListener(InvokeEvent.INVOKE,invokeHandler);
However, I can not tell if that's going to stop things at the proper point, or if it's even possible to actually STOP the request - if so, how?
Thanks!
Check out this question
Flex : Is it possible to stop a remote call?
If you're using a RemoteObject you should be able to call
getOperation() method and then cancel() on the corresponding
operation.

Flex: Cancel HTTPService.send()?

OK I have an HTTPService that executes the dataLoaded(e:ResultEvent):void function whenever it gets a result from a send() call.
OK so If I call HTTPService.send() and then call HTTPService.send() again before the previous one receives a result, I end up repeatedly running dataLoaded() which is undesirable
What I want is if HTTPService.send() gets called before a previous call to it returns a result. I want to cancel the first call, and only process the result from the last call to HTTPService.send()
I hope this makes sense.
How can I do that??
Thanks!!
HTTPService has a cancel method. If you call it without its parameter, it should cancel the last invocation of the service. Give that a try and see if you're still getting undesired ResultEvents.
Use the existence of the ASyncToken to determine whether cancellation is appropriate.
private var _serviceCall:ASyncToken;
function callMyService(stuff:Object):void {
if (_serviceCall !== null) {
myService.cancel();
_serviceCall = null;
}
_serviceCall = myService.send(stuff)
}
Actually HTTPService can manage this for you. It has a concurrency property, which you should probably set to "last".
More info here: HTTPService#concurrency
In addition to Robert's answer: Flex: Cancel HTTPService.send()?
HTTPService#concurrency seems to be introduced until Flex 4, I don't find this in Flex 3.. In Flex 3., you have to cancel the previous call manually in contrast to concurrency="last" in Flex 4.
Note that this won't interrupt server process that previous call invokes, it means server may still come out a response however flex abandon that already.

Resources