jruby-executors 0.1.0-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.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 68cb86d268c8596d3b6b8950dc84fdbc242fb700
4
+ data.tar.gz: bfdcd5dcbe569560a8583c95a79492d9e587a562
5
+ SHA512:
6
+ metadata.gz: 088f23022e7c6a7ee42b900d9be1c7f77281bc35ef0d8226e79aebfaff3d3d19943b53cecd3fb65f6b42a3ffe912b800314b1856e627b776d25ce513740ac0db
7
+ data.tar.gz: 38da54ce04338407f70b11fef752414d8a7c690106836876201554a849e5b71c9bf23b6ab7d51437f24cbade7eb22e553261c798d85c64267b619e247264c345
@@ -0,0 +1 @@
1
+ *.gem
@@ -0,0 +1,17 @@
1
+ # -*- encoding: utf-8 -*-
2
+
3
+ Gem::Specification.new do |s|
4
+ s.name = %q{jruby-executors}
5
+ s.version = "0.1.0"
6
+ s.authors = ["Joe Kutner"]
7
+ s.date = Time.now
8
+ s.description = "The Gem provides an easy interface to the JRuby Executors library."
9
+ s.email = ["jpkutner@gmail.com"]
10
+ s.homepage = "http://github.com/jkutner/get_back"
11
+ s.require_paths = ["lib"]
12
+ s.summary = "Easy Thread Pools for JRuby"
13
+ s.files = `git ls-files`.split("\n")
14
+ s.test_files = `git ls-files -- {test,spec,features,integration}/*`.split("\n")
15
+ s.platform = "java"
16
+ s.license = 'MIT'
17
+ end
@@ -0,0 +1,3 @@
1
+ # -*- ruby encoding: utf-8 -*-
2
+
3
+ require 'jruby/executors'
@@ -0,0 +1,26 @@
1
+ require 'java'
2
+
3
+ java_import('java.util.concurrent.Executors') {|p,c| "JavaExecutors"}
4
+ java_import 'java.lang.Runnable'
5
+
6
+ class JRuby::Executors
7
+ def self.new_cached_thread_pool
8
+ new(JavaExecutors.newCachedThreadPool)
9
+ end
10
+
11
+ def self.new_fixed_thread_pool(n_threads)
12
+ new(JavaExecutors.newFixedThreadPool(n_threads))
13
+ end
14
+
15
+ def initialize(executor_service)
16
+ @executor_service = executor_service
17
+ end
18
+
19
+ def method_missing(method_name, *args, &block)
20
+ @executor_service.send method_name, *args, &block
21
+ end
22
+
23
+ def submit(&block)
24
+ @executor_service.java_method(:submit, [Runnable.java_class]).call(&block)
25
+ end
26
+ end
@@ -0,0 +1,14 @@
1
+ require_relative "../../lib/jruby/executors.rb"
2
+ require "test/unit"
3
+
4
+ class TestExecutors < Test::Unit::TestCase
5
+ def test_new_cached_thread_pool
6
+ tp = JRuby::Executors.new_cached_thread_pool
7
+ f = tp.submit do
8
+ assert_equal(true, true)
9
+ end
10
+ f.get
11
+ ensure
12
+ tp.shutdown
13
+ end
14
+ end
metadata ADDED
@@ -0,0 +1,50 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: jruby-executors
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: java
6
+ authors:
7
+ - Joe Kutner
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-07-28 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: The Gem provides an easy interface to the JRuby Executors library.
14
+ email:
15
+ - jpkutner@gmail.com
16
+ executables: []
17
+ extensions: []
18
+ extra_rdoc_files: []
19
+ files:
20
+ - ".gitignore"
21
+ - jruby-executors.gemspec
22
+ - lib/jruby-executors.rb
23
+ - lib/jruby/executors.rb
24
+ - test/jruby/executors_test.rb
25
+ homepage: http://github.com/jkutner/get_back
26
+ licenses:
27
+ - MIT
28
+ metadata: {}
29
+ post_install_message:
30
+ rdoc_options: []
31
+ require_paths:
32
+ - lib
33
+ required_ruby_version: !ruby/object:Gem::Requirement
34
+ requirements:
35
+ - - ">="
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ required_rubygems_version: !ruby/object:Gem::Requirement
39
+ requirements:
40
+ - - ">="
41
+ - !ruby/object:Gem::Version
42
+ version: '0'
43
+ requirements: []
44
+ rubyforge_project:
45
+ rubygems_version: 2.4.8
46
+ signing_key:
47
+ specification_version: 4
48
+ summary: Easy Thread Pools for JRuby
49
+ test_files:
50
+ - test/jruby/executors_test.rb