dev@grizzly.java.net

Re: Code changes to fix issue in logic of async execution of Jruby

From: Jeanfrancois Arcand <Jeanfrancois.Arcand_at_Sun.COM>
Date: Tue, 26 Feb 2008 10:07:45 -0500

Hi Pramod,

Pramod Gopinath wrote:
> 2 Code changes both dealing with the support of asynchronous request
> processing (ARP) in grizzly-jruby module.
> Think that the current timelimit provided is low, hence changing the
> time to be 360 seconds (5 minutes). Not sure if this is large/small
> enough. Want to know what you guys feel on that ?

OK I've waked up and -1 :-) Why? Because if gonna waste a thread for 5
minutes if we increase the time out :-) Instead of applying your patch,
I've opened issue:

https://grizzly.dev.java.net/issues/show_bug.cgi?id=71

Mainly, when we decide to suspend a request, we need to make sure it
will eventually be resumed (not sure how comes the resume/unpark was not
longer called...blame me :-)).

Let me know what you think?

Thanks!

-- Jeanfrancois




> Fixing the logic where the queue poll would not happen if the queue has
> been enabled for asynchronous requests.
>
> All the change is in
> module/jruby/src/main/java/com/sun/grizzly/jruby/RubyObjectPool.java.
>
> The svn diff is provided below :
>
> Thanks
> Pramod Gopinath
>
>
> pramod-gopinaths-computer:~/work_related/grizzly_code/grizzly/tags/1_7_2/modules/jruby
> pramodgopinath$ svn diff
> src/main/java/com/sun/grizzly/jruby/RubyObjectPool.java
> Index: src/main/java/com/sun/grizzly/jruby/RubyObjectPool.java
> ===================================================================
> --- src/main/java/com/sun/grizzly/jruby/RubyObjectPool.java
> (revision 856)
> +++ src/main/java/com/sun/grizzly/jruby/RubyObjectPool.java (working
> copy)
> @@ -44,7 +44,7 @@
> public class RubyObjectPool {
>
> /** How long to wait before given up. */
> - private static long DEFAULT_TIMEOUT = 1000L;
> + private static long DEFAULT_TIMEOUT = 360L;
>
> /** JRUBY_LIB directory */
> private String jrubyLib = null;
> @@ -70,9 +70,9 @@
> * @return JRuby runtime.
> */
> public Ruby borrowRuntime() {
> - if (!isAsyncEnabled()){
> + if (isAsyncEnabled()){
> try {
> - return queue.poll(DEFAULT_TIMEOUT, TimeUnit.MILLISECONDS);
> + return queue.poll(DEFAULT_TIMEOUT, TimeUnit.SECONDS);
> } catch (InterruptedException e) {
> throw new RuntimeException(e);
> }
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe_at_grizzly.dev.java.net
> For additional commands, e-mail: dev-help_at_grizzly.dev.java.net
>