Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Added new option jruby.timeout.thread.pool.max to control the max number... #622

Merged
merged 1 commit into from

2 participants

Jeff Simpson Hiro Asari
Jeff Simpson

Added new option, jruby.timeout.thread.pool.max, to enable the ability to override the max timeout worker threadpool size. The default still remains the # of cores available.

Hiro Asari BanzaiMan merged commit c7c3266 into from
Hiro Asari BanzaiMan was assigned
Jeff Simpson

thanks!

Jeff Simpson fooblahblah deleted the branch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Apr 1, 2013
  1. Added new option jruby.timeout.thread.pool.max to control the max num…

    Jeff Simpson authored
    …ber of Timeout worker threads.
This page is out of date. Refresh to see the latest.
7 src/org/jruby/RubyInstanceConfig.java
View
@@ -1495,6 +1495,13 @@ public boolean shouldPrecompileAll() {
public static final int POOL_TTL = Options.THREADPOOL_TTL.load();
/**
+ * Maximum timeout thread pool size (integer, default # of cores).
+ *
+ * Set with the <tt>jruby.timeout.thread.pool.max</tt> system property.
+ */
+ public static final int TIMEOUT_POOL_MAX = Options.TIMEOUT_THREADPOOL_MAX.load();
+
+ /**
* Enable use of the native Java version of the 'net/protocol' library.
*
* Set with the <tt>jruby.thread.pool.max</tt> system property.
3  src/org/jruby/ext/timeout/Timeout.java
View
@@ -36,6 +36,7 @@
import org.jruby.Ruby;
import org.jruby.RubyClass;
import org.jruby.RubyFixnum;
+import org.jruby.RubyInstanceConfig;
import org.jruby.RubyKernel;
import org.jruby.RubyModule;
import org.jruby.RubyObject;
@@ -78,7 +79,7 @@ public void load(Ruby runtime, boolean wrap) throws IOException {
runtime.getObject().defineAnnotatedMethods(TimeoutToplevel.class);
}
- private static ScheduledExecutorService timeoutExecutor = Executors.newScheduledThreadPool(Runtime.getRuntime().availableProcessors(), new DaemonThreadFactory());
+ private static ScheduledExecutorService timeoutExecutor = Executors.newScheduledThreadPool(RubyInstanceConfig.TIMEOUT_POOL_MAX, new DaemonThreadFactory("JRubyTimeoutWorker"));
public static class TimeoutToplevel {
@JRubyMethod(required = 1, optional = 1, visibility = PRIVATE)
2  src/org/jruby/util/cli/Options.java
View
@@ -189,6 +189,8 @@ public static String dump() {
public static final Option<Boolean> FFI_COMPILE_INVOKEDYNAMIC = bool(NATIVE, "ffi.compile.invokedynamic", false, "Use invokedynamic to bind FFI invocations.");
public static final Option<Boolean> FFI_COMPILE_REIFY = bool(NATIVE, "ffi.compile.reify", false, "Reify FFI compiled classes.");
+ public static final Option<Integer> TIMEOUT_THREADPOOL_MAX = integer(THREADPOOL, "timeout.thread.pool.max", Runtime.getRuntime().availableProcessors(), "The maximum number of threads to allow in the timeout pool.");
+
public static final Option<Boolean> THREADPOOL_ENABLED = bool(THREADPOOL, "thread.pool.enabled", false, "Enable reuse of native threads via a thread pool.");
public static final Option<Integer> THREADPOOL_MIN = integer(THREADPOOL, "thread.pool.min", 0, "The minimum number of threads to keep alive in the pool.");
public static final Option<Integer> THREADPOOL_MAX = integer(THREADPOOL, "thread.pool.max", Integer.MAX_VALUE, "The maximum number of threads to allow in the pool.");
Something went wrong with that request. Please try again.