jruby-management 0.0.1-java
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gitignore +4 -0
- data/Gemfile +4 -0
- data/README.md +8 -0
- data/Rakefile +1 -0
- data/jruby-management.gemspec +25 -0
- data/lib/jruby/management.rb +20 -0
- data/lib/jruby/management/profiler_mbean.rb +36 -0
- data/lib/jruby/management/version.rb +5 -0
- metadata +81 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
data/README.md
ADDED
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "jruby/management/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = "jruby-management"
|
7
|
+
s.version = JRuby::Management::VERSION
|
8
|
+
s.authors = ["Douglas Campos"]
|
9
|
+
s.email = ["qmx@qmx.me"]
|
10
|
+
s.homepage = ""
|
11
|
+
s.summary = %q{JRuby Management MBeans}
|
12
|
+
s.description = %q{JRuby JMX Management Tools}
|
13
|
+
|
14
|
+
s.platform = "java"
|
15
|
+
s.rubyforge_project = "jruby-management"
|
16
|
+
|
17
|
+
s.files = `git ls-files`.split("\n")
|
18
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
19
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
20
|
+
s.require_paths = ["lib"]
|
21
|
+
|
22
|
+
# specify any dependencies here; for example:
|
23
|
+
# s.add_development_dependency "rspec"
|
24
|
+
s.add_dependency "jmx4r"
|
25
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
require "jruby"
|
2
|
+
require "jmx4r"
|
3
|
+
require "jruby/management/version"
|
4
|
+
require "jruby/management/profiler_mbean"
|
5
|
+
|
6
|
+
module JRuby
|
7
|
+
module Management
|
8
|
+
import java.lang.management.ManagementFactory
|
9
|
+
import javax.management.ObjectName
|
10
|
+
|
11
|
+
def register_mbean(clazz)
|
12
|
+
object_name = ObjectName.new("org.jruby.management:name=#{clazz.mbean_name}")
|
13
|
+
ManagementFactory.platform_mbean_server.register_mbean(clazz.new, object_name)
|
14
|
+
end
|
15
|
+
|
16
|
+
module_function :register_mbean
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
JRuby::Management.register_mbean(JRuby::Management::ProfilerMBean)
|
@@ -0,0 +1,36 @@
|
|
1
|
+
module JRuby
|
2
|
+
module Management
|
3
|
+
class ProfilerMBean < JMX::DynamicMBean
|
4
|
+
class << JRuby.runtime
|
5
|
+
field_reader :config
|
6
|
+
end
|
7
|
+
|
8
|
+
operation "enables profiler"
|
9
|
+
returns :void
|
10
|
+
def enable_profiling
|
11
|
+
JRuby.runtime.config.profiling_mode = org.jruby.RubyInstanceConfig::ProfilingMode::GRAPH
|
12
|
+
JRuby.reference(JRuby.runtime.kernel).invalidate_cache_descendants
|
13
|
+
end
|
14
|
+
|
15
|
+
operation "dumps profiler info to specified file"
|
16
|
+
parameter :string, "path", "path to write profiling results"
|
17
|
+
returns :void
|
18
|
+
def dump_profile_info(path)
|
19
|
+
runtime = JRuby.runtime
|
20
|
+
file = open(path, 'w+')
|
21
|
+
runtime.thread_service.ruby_thread_map.each do |t, rubythread|
|
22
|
+
file.puts("\n#{t} profile results:")
|
23
|
+
context = JRuby.reference(rubythread).context
|
24
|
+
profile_data = context.profile_data
|
25
|
+
printer = runtime.instance_config.make_default_profile_printer(profile_data)
|
26
|
+
printer.printProfile(file)
|
27
|
+
end
|
28
|
+
file.close
|
29
|
+
end
|
30
|
+
|
31
|
+
def self.mbean_name
|
32
|
+
"ProfilerMBean"
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
metadata
ADDED
@@ -0,0 +1,81 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: jruby-management
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease: false
|
5
|
+
segments:
|
6
|
+
- 0
|
7
|
+
- 0
|
8
|
+
- 1
|
9
|
+
version: 0.0.1
|
10
|
+
platform: java
|
11
|
+
authors:
|
12
|
+
- Douglas Campos
|
13
|
+
autorequire:
|
14
|
+
bindir: bin
|
15
|
+
cert_chain: []
|
16
|
+
|
17
|
+
date: 2011-11-11 00:00:00 -02:00
|
18
|
+
default_executable:
|
19
|
+
dependencies:
|
20
|
+
- !ruby/object:Gem::Dependency
|
21
|
+
name: jmx4r
|
22
|
+
prerelease: false
|
23
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
25
|
+
- - ">="
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
segments:
|
28
|
+
- 0
|
29
|
+
version: "0"
|
30
|
+
type: :runtime
|
31
|
+
version_requirements: *id001
|
32
|
+
description: JRuby JMX Management Tools
|
33
|
+
email:
|
34
|
+
- qmx@qmx.me
|
35
|
+
executables: []
|
36
|
+
|
37
|
+
extensions: []
|
38
|
+
|
39
|
+
extra_rdoc_files: []
|
40
|
+
|
41
|
+
files:
|
42
|
+
- .gitignore
|
43
|
+
- Gemfile
|
44
|
+
- README.md
|
45
|
+
- Rakefile
|
46
|
+
- jruby-management.gemspec
|
47
|
+
- lib/jruby/management.rb
|
48
|
+
- lib/jruby/management/profiler_mbean.rb
|
49
|
+
- lib/jruby/management/version.rb
|
50
|
+
has_rdoc: true
|
51
|
+
homepage: ""
|
52
|
+
licenses: []
|
53
|
+
|
54
|
+
post_install_message:
|
55
|
+
rdoc_options: []
|
56
|
+
|
57
|
+
require_paths:
|
58
|
+
- lib
|
59
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
60
|
+
requirements:
|
61
|
+
- - ">="
|
62
|
+
- !ruby/object:Gem::Version
|
63
|
+
segments:
|
64
|
+
- 0
|
65
|
+
version: "0"
|
66
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
67
|
+
requirements:
|
68
|
+
- - ">="
|
69
|
+
- !ruby/object:Gem::Version
|
70
|
+
segments:
|
71
|
+
- 0
|
72
|
+
version: "0"
|
73
|
+
requirements: []
|
74
|
+
|
75
|
+
rubyforge_project: jruby-management
|
76
|
+
rubygems_version: 1.3.6
|
77
|
+
signing_key:
|
78
|
+
specification_version: 3
|
79
|
+
summary: JRuby Management MBeans
|
80
|
+
test_files: []
|
81
|
+
|