dev@grizzly.java.net

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

From: Pramod Gopinath <Pramod.Gopinath_at_Sun.COM>
Date: Mon, 25 Feb 2008 11:50:07 -0800

Hi Jeanfrancois
  Sending in the diff file for this change too.

Thanks
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 ?
> 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
>


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);
             }