<br><br><div class="gmail_quote">On Mon, Sep 10, 2012 at 8:17 PM, Jay McCarthy <span dir="ltr"><<a href="mailto:jay.mccarthy@gmail.com" target="_blank">jay.mccarthy@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
I'm not sure what error you're referring to in the second case, </blockquote><div><br></div><div>The error as posted on <a href="http://stackoverflow.com/questions/12343071/how-to-make-the-time-out-of-one-connection-of-the-server-while-not-affecting-fol/12355117#12355117">http://stackoverflow.com/questions/12343071/how-to-make-the-time-out-of-one-connection-of-the-server-while-not-affecting-fol/12355117#12355117</a>..</div>
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">unless<br>
you mean that the timeout is shorter than the expected availability of<br>
job A's results, in which case you should expect it to be an error,<br>
because you went over the time limit.<br></blockquote><div>No. the exception appeared not because that the time to generate A's result is longer than the timeout limit, it seems that the manager has timed out the whole server that following requests would fail because of the exception throwed.</div>
<div> </div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
If you used the LRU manager and then combined that with an<br>
auto-updating Javascript refresh, then the browser would continually<br>
give the continuation "life points" and it would never be reclaimed<br>
until it stopped being refreshed and you faced memory pressure.<br>
<br></blockquote><div>Thanks for pointing out the LRU manager..do you mean I changed the timeout manager to LRU manger in the servlet?</div><div>But even if I use the LRU manger, can the @syntax in the template page get their values and have the new page generated, when JS refreshes the result.html by using windows.location = "result.html" ( and the page that I want to refresh, e.g. result.html, it uses racket template to dynamically generate html page)</div>
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
If you can't rely on Javascript, you could have the server run another<br>
thread that continually called continuation-lookup on your LRU manager<br>
to give it life points directly.<br></blockquote><div> </div><div>the continuation-lookup will return a continuation back if all the ids match on the LRU manger, (which can be pulled out from the servlet I imagined?). but what do you mean by ''give it life points directly"?</div>
<div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
A similar approach would be to write your own manager that associated<br>
continuations with these long-running jobs and only freed them after<br>
the job was completed.<br>
<br></blockquote><div>I will see whether it works for the previous two approaches you mentioned first maybe...</div><div><br></div><div>Maybe there are some dumb questions in this reply because of not really using these features before, But thanks for your attention,</div>
<div>--Shuying</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div><div class="h5"><br>
On Sun, Sep 9, 2012 at 5:13 PM, jenny sun <<a href="mailto:jenny.sun.jenny.sun@gmail.com">jenny.sun.jenny.sun@gmail.com</a>> wrote:<br>
> Hi,<br>
><br>
> I have a problem.<br>
><br>
> The web application will do some job A, which takes long time, so I make a<br>
> thread to do the job A and make a refresh button for that to pull the result<br>
> back.<br>
><br>
> However, the problem is that, if A takes long time, the session in the user<br>
> side will be timed out, which A's results can not be accessed.<br>
><br>
> So I tried three solutions, it seems that none of them can be done easily in<br>
> racket:<br>
><br>
> Solution 1: make the server never timeout. But this cause too much<br>
> resources.<br>
><br>
> Solution 2: create a timeout manager specifying some time, like this in<br>
> serve/servlet<br>
><br>
> #:manager (create-timeout-manager<br>
> (lambda (req)<br>
> (response/full<br>
> 200 #"Okay"<br>
> (current-seconds) TEXT/HTML-MIME-TYPE<br>
> empty<br>
> (list (string->bytes/utf-8 (include-template<br>
> "templates/timeout.html")))))<br>
> 3600 3600) ; an hour timeout...<br>
> The problem of this solution is that it will have exception thrown out if<br>
> user trying to access to server if it is timeout. In other words, the server<br>
> will be unavailable entirely if it is timed out, which is undesirable!<br>
><br>
> Solution 3: write a JS to automatically refresh the web pages to pull the<br>
> result. But the problem is that the template html file is dynamically<br>
> generated, when refreshing, it can not access to all the scoped variables in<br>
> racket to generate a new page!<br>
><br>
> Therefore, does anyone have idea how to deal with the problems? or suggest<br>
> other solutions suitable for my case?<br>
><br>
><br>
><br>
</div></div>> ____________________<br>
> Racket Users list:<br>
> <a href="http://lists.racket-lang.org/users" target="_blank">http://lists.racket-lang.org/users</a><br>
><br>
<span class="HOEnZb"><font color="#888888"><br>
<br>
<br>
--<br>
Jay McCarthy <<a href="mailto:jay@cs.byu.edu">jay@cs.byu.edu</a>><br>
Assistant Professor / Brigham Young University<br>
<a href="http://faculty.cs.byu.edu/~jay" target="_blank">http://faculty.cs.byu.edu/~jay</a><br>
<br>
"The glory of God is Intelligence" - D&C 93<br>
</font></span></blockquote></div><br>