Ejemplo n.º 1
0
  private void jitThresholdReached(
      final DefaultMethod method,
      final RubyInstanceConfig config,
      ThreadContext context,
      final String className,
      final String methodName) {
    // Disable any other jit tasks from entering queue
    method.setCallCount(-1);

    final Ruby runtime = context.runtime;

    Runnable jitTask = new JITTask(className, method, methodName);

    // if background JIT is enabled and threshold is > 0 and we have an executor...
    if (config.getJitBackground() && config.getJitThreshold() > 0 && executor != null) {
      // JIT in background
      try {
        executor.submit(jitTask);
      } catch (RejectedExecutionException ree) {
        // failed to submit, just run it directly
        jitTask.run();
      }
    } else {
      // just run directly
      jitTask.run();
    }
  }