... HUGE release in terms of (compatibility and some performance) fixes
... invokedynamic disabled by default on Java 7 (otherwise -Xcompile.invokedynamics=false)
# require 'active_record/connection_adapters/abstract_adapter' | |
# Adapter (connection) compatibility methods for AR 2.3 as required | |
# by the (AR 3.2) back-ported ConnectionPool implementation. | |
class ActiveRecord::ConnectionAdapters::AbstractAdapter | |
include MonitorMixin | |
# HACK: to initialize the monitor, in 3.2 #initialize calls the | |
# MonitorMixin#initialize by doing super() but in 2.3 it does not | |
# we do about the same here by overriding Adapter#new : |
# put this under **#{Rails.root}/config/initializers** directory | |
# `silence` is like Chuck Norris you can't kill it, this biuty got yet again | |
# re-invented in Rails 4 right after Logger#silence got deprecated in 3.2 :) | |
begin | |
require 'active_support/logger' | |
require 'active_support/logger_silence' | |
ActiveSupport::Logger.silencer = false # silence simply yields | |
# if 'active_support/core_ext/logger' is loaded |
#ruby=1.9.3 | |
# Gemfile header for using JRuby (on Heroku) as well as MRI locally | |
source 'https://rubygems.org' | |
if ENV["JRUBY"] || RUBY_PLATFORM == "java" | |
# https://devcenter.heroku.com/articles/ruby-support#ruby-versions | |
ruby '1.9.3', engine: 'jruby', engine_version: '1.7.10' | |
else | |
ruby '1.9.3' | |
end |
require 'jruby/profiler' | |
profile_data = JRuby::Profiler.profile do | |
# code to be profiled.... | |
end | |
# print data in flat format to STDOUT : | |
profile_printer = JRuby::Profiler::FlatProfilePrinter.new(profile_data) | |
profile_printer.printProfile(STDOUT) |
# Emulates the SerialPort class that uses a native C extension. | |
class SerialPort < IO | |
load "java/jna.jar" | |
load "java/purejavacomm-0.0.21.jar" | |
java_import 'purejavacomm.CommPortIdentifier' | |
def initialize(port) | |
# do what SerialPort C does on Windows (for compat): 0 -> 'COM1' | |
port = "COM#{port + 1}" if port.is_a?(Integer) && windows? |
error = nil | |
# This processes the action in a child thread. It lets us return the | |
# response code and headers back up the rack stack, and still process | |
# the body in parallel with sending data to the client | |
Thread.new { | |
begin | |
super(name) | |
rescue => e | |
if @_response.committed? | |
begin |
# Monkeypatch to disable connection pooling in ActiveRecord | |
module ActiveRecord | |
module ConnectionAdapters | |
class ConnectionPool | |
def checkout | |
c = ActiveRecord::Base.send(spec.adapter_method, spec.config.dup) | |
c.verify! | |
c | |
end |
... HUGE release in terms of (compatibility and some performance) fixes
... invokedynamic disabled by default on Java 7 (otherwise -Xcompile.invokedynamics=false)
require 'benchmark' | |
TIMES = 10_000 | |
Benchmark.bmbm do |x| | |
x.report("java.lang.System.get_property [#{TIMES}x]") do | |
TIMES.times do | |
java.lang.System.get_property('jars.skip') == 'true' | |
end |
require 'celluloid/stack_dump' | |
module Celluloid | |
class StackDump | |
class ActorState | |
attr_accessor :thread_name, :thread_id | |
def dump |