This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'ffi' | |
module MemoryLock | |
extend FFI::Library | |
ffi_lib FFI::Library::LIBC | |
# int mlockall(int flags); | |
attach_function :mlockall, [:int], :int | |
# int munlockall(void); | |
attach_function :munlockall, [], :int |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# frozen_string_literal: true | |
class Object | |
# Convert to a boolean value (special cased for String/Numeric). | |
# @return [Boolean] false for nil and false ('true', '1' return true and 0 returns false) | |
# @see String#to_bool | |
# @see Numeric#to_bool | |
def to_bool | |
!!self | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Thread 0x1a1962 (): | |
/usr/local/rvm/rubies/jruby-9.1.17.0/lib/ruby/stdlib/monitor.rb:111:in `wait' | |
/usr/local/rvm/rubies/jruby-9.1.17.0/lib/ruby/stdlib/monitor.rb:111:in `wait' | |
/srv/phone/apptastic/shared/bundle/jruby/2.3.0/gems/future-resource-1.1.0/lib/future-resource.rb:66:in `resource' | |
/usr/local/rvm/rubies/jruby-9.1.17.0/lib/ruby/stdlib/monitor.rb:214:in `mon_synchronize' | |
/srv/phone/apptastic/shared/bundle/jruby/2.3.0/gems/future-resource-1.1.0/lib/future-resource.rb:65:in `resource' | |
/srv/phone/apptastic/shared/bundle/jruby/2.3.0/gems/future-resource-1.1.0/lib/future-resource.rb:64:in `timeout' | |
/srv/phone/apptastic/shared/bundle/jruby/2.3.0/gems/future-resource-1.1.0/lib/future-resource.rb:64:in `resource' | |
/srv/phone/apptastic/shared/bundle/jruby/2.3.0/bundler/gems/adhearsion-2676734110e0/lib/adhearsion/rayo/component/component_node.rb:56:in `complete_event' | |
/srv/phone/apptastic/shared/bundle/jruby/2.3.0/bundler/gems/adhearsion-2676734110e0/lib/adhearsion/call_controller.rb:230:in `execute_compon |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'logger' | |
class MonitorDaemon | |
LOG_FILE = 'monitor.log' | |
LOG_FILES_MAX = 10 * 1024 * 1024 # 10MB | |
LOG_FILES_KEEP = 10 # keep 10 (max 100MB) | |
LOGGER = begin | |
if $servlet_context && ENV_JAVA['catalina.base'] && # {tomcat_base}/logs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Licensed under the "Apache License, Version 2.0" (c) 2010 | |
/** | |
* Returns filenames found by expanding the passed pattern which is String or | |
* a List of patterns. | |
* NOTE: that this pattern is not a regexp (it’s closer to a shell glob). | |
* NOTE: that case sensitivity depends on your system. | |
* | |
* <code>*</code> Matches any file. Can be restricted by other values in | |
* the glob pattern (same as <code>.*</code> in regexp). | |
* <code>*</code> will match all files, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if File.basename($0) == 'rake' && ARGV.include?('assets:precompile') # Rails.env.production? | |
puts "patching sass functions to return relative asset paths" if $VERBOSE | |
begin | |
require 'sprockets/sass/functions' | |
sass_functions = Sprockets::Sass::Functions | |
Autoload::Sass::Script rescue nil # loading | |
rescue LoadError # 2.x | |
require 'sprockets/sass_functions' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
map( heap.objects('org.jruby.runtime.ThreadContext'), function(ctx) { | |
var str = toHtml(ctx) + " oid: " + objectid(ctx); | |
str += " "; | |
var toHtmlObj = function(obj) { return "<br> " + toHtml(obj); }; | |
try { | |
//return str + doObjPath(ctx, toHtmlObj, 'thread', 'threadImpl', 'nativeThread', 'referent'); | |
str += resolveObjPath(ctx, 'thread', 'threadImpl', 'nativeThread', 'referent', 'name').toString(); | |
str += '<br> backtraceIndex = ' + ctx.backtraceIndex; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'logger' | |
Class.new do | |
LOGGER = Logger.new(STDOUT) | |
# Logger.new File.open('jmx.log', File::WRONLY | File::APPEND) | |
def initialize; @done = nil end | |
def start |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var simpleFormatRE1 = /\r\n?/g; | |
var simpleFormatRE2 = /\n\n+/g; | |
var simpleFormatRE3 = /([^\n]\n)(?=[^\n])/g; | |
function simpleFormat(str) { | |
var fstr = str; | |
fstr = fstr.replace(simpleFormatRE1, "\n") // \r\n and \r -> \n | |
fstr = fstr.replace(simpleFormatRE2, "</p>\n\n<p>") // 2+ newline -> paragraph | |
fstr = fstr.replace(simpleFormatRE3, "$1<br/>") // 1 newline -> br | |
fstr = "<p>" + fstr + "</p>"; | |
return fstr; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if JRUBY_VERSION < '1.7.19' | |
require 'thread'; require 'java' | |
org.jruby.RubyThreadGroup.field_reader :rubyThreadList | |
ThreadGroup.class_eval do | |
def list | |
threads = [] | |
list = to_java.rubyThreadList | |
list.synchronized do # iterator must be sync-ed | |
list.each { |t| threads << t if t } | |
end |