<br><br><div class="gmail_quote">On Mon, Sep 10, 2012 at 8:17 PM, Jay McCarthy <span dir="ltr">&lt;<a href="mailto:jay.mccarthy@gmail.com" target="_blank">jay.mccarthy@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
I&#39;m not sure what error you&#39;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&#39;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&#39;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 &quot;life points&quot; 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 = &quot;result.html&quot; ( 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&#39;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 &#39;&#39;give it life points directly&quot;?</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 &lt;<a href="mailto:jenny.sun.jenny.sun@gmail.com">jenny.sun.jenny.sun@gmail.com</a>&gt; wrote:<br>
&gt; Hi,<br>
&gt;<br>
&gt; I have a problem.<br>
&gt;<br>
&gt; The web application will do some job A, which takes long time, so I make a<br>
&gt; thread to do the job A and make a refresh button for that to pull the result<br>
&gt; back.<br>
&gt;<br>
&gt; However, the problem is that, if A takes long time, the session in the user<br>
&gt; side will be timed out, which A&#39;s results can not be accessed.<br>
&gt;<br>
&gt; So I tried three solutions, it seems that none of them can be done easily in<br>
&gt; racket:<br>
&gt;<br>
&gt; Solution 1: make the server never timeout. But this cause too much<br>
&gt; resources.<br>
&gt;<br>
&gt; Solution 2: create a timeout manager specifying some time, like this in<br>
&gt; serve/servlet<br>
&gt;<br>
&gt; #:manager (create-timeout-manager<br>
&gt; (lambda (req)<br>
&gt; (response/full<br>
&gt; 200 #&quot;Okay&quot;<br>
&gt; (current-seconds) TEXT/HTML-MIME-TYPE<br>
&gt; empty<br>
&gt; (list (string-&gt;bytes/utf-8 (include-template<br>
&gt; &quot;templates/timeout.html&quot;)))))<br>
&gt; 3600 3600) ; an hour timeout...<br>
&gt; The problem of this solution is that it will have exception thrown out if<br>
&gt; user trying to access to server if it is timeout. In other words, the server<br>
&gt; will be unavailable entirely if it is timed out, which is undesirable!<br>
&gt;<br>
&gt; Solution 3: write a JS to automatically refresh the web pages to pull the<br>
&gt; result. But the problem is that the template html file is dynamically<br>
&gt; generated, when refreshing, it can not access to all the scoped variables in<br>
&gt; racket to generate a new page!<br>
&gt;<br>
&gt; Therefore, does anyone have idea how to deal with the problems? or suggest<br>
&gt; other solutions suitable for my case?<br>
&gt;<br>
&gt;<br>
&gt;<br>
</div></div>&gt; ____________________<br>
&gt; Racket Users list:<br>
&gt; <a href="http://lists.racket-lang.org/users" target="_blank">http://lists.racket-lang.org/users</a><br>
&gt;<br>
<span class="HOEnZb"><font color="#888888"><br>
<br>
<br>
--<br>
Jay McCarthy &lt;<a href="mailto:jay@cs.byu.edu">jay@cs.byu.edu</a>&gt;<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>
&quot;The glory of God is Intelligence&quot; - D&amp;C 93<br>
</font></span></blockquote></div><br>