module Kernel

Monkeypatch for JRUBY-6970

Public Instance Methods

load(path) click to toggle source
# File lib/logstash/monkeypatches-for-debugging.rb, line 42
def load(path)
  puts "load(\"#{path}\")"
  return load_debug(path)
end
Also aliased as: load_debug
load_debug(path)
Alias for: load
require(path) click to toggle source
# File lib/logstash/JRUBY-6970.rb, line 6
def require(path)
  old_load_path = nil

  if path =~ /^jar:file:.+!.+/
    path = path.gsub(/^jar:/, "")
    puts "JRUBY-6970: require(#{path})" if ENV["REQUIRE_DEBUG"] == "1"
  end

  # Work around slow openssl load times in flatjar. (LOGSTASH-1223)
  # I don't know why this works, I don't care either. This problem only
  # exists in the 'jar' builds of logstash which are going to be going away
  # soon in favor of the much-better tarball/zip releases!
  if __FILE__ =~ /^(?:jar:)?file:.+!.+/ && path == "openssl"
    # Loading shared/jruby-openssl first seems to make openssl load faster
    # I have no idea. Computers.
    require_JRUBY_6970_hack "shared/jruby-openssl"
    return require_JRUBY_6970_hack "openssl"
  end

  # JRUBY-7065
  path = File.expand_path(path) if path.include?("/../")
  rc = require_JRUBY_6970_hack(path)

  # Only monkeypatch openssl after it's been loaded.
  if path == "openssl"
    require "logstash/JRUBY-6970-openssl"
  end
  return rc
end
require_JRUBY_6970_hack(path)
Alias for: require
require_debug(path)
Alias for: require