mailbox 0.1.4 → 0.1.6
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/Rakefile +4 -0
- data/VERSION.yml +1 -1
- data/lib/mailbox.rb +7 -4
- data/mailbox.gemspec +9 -5
- data/test/mailbox_test.rb +7 -8
- metadata +80 -72
data/Rakefile
CHANGED
@@ -29,9 +29,13 @@ Jeweler::Tasks.new do |gemspec|
|
|
29
29
|
|
30
30
|
gemspec.add_dependency "jretlang"
|
31
31
|
|
32
|
+
gemspec.add_development_dependency "jeweler"
|
33
|
+
|
32
34
|
gemspec.rubyforge_project = "mailbox"
|
33
35
|
end
|
34
36
|
|
37
|
+
Jeweler::GemcutterTasks.new
|
38
|
+
|
35
39
|
Jeweler::RubyforgeTasks.new do |rubyforge|
|
36
40
|
rubyforge.doc_task = "rdoc"
|
37
41
|
end
|
data/VERSION.yml
CHANGED
data/lib/mailbox.rb
CHANGED
@@ -32,7 +32,6 @@ module Mailbox
|
|
32
32
|
end
|
33
33
|
|
34
34
|
private
|
35
|
-
|
36
35
|
def self.included(base)
|
37
36
|
base.extend(Mailbox::ClassMethods)
|
38
37
|
end
|
@@ -49,11 +48,15 @@ module Mailbox
|
|
49
48
|
|
50
49
|
def __synchronous_fiber__
|
51
50
|
executor = JRL::SynchronousDisposingExecutor.new
|
52
|
-
fiber = JRL::Fibers::ThreadFiber.new executor, "
|
51
|
+
fiber = JRL::Fibers::ThreadFiber.new executor, "#{self.class.name} #{self.object_id} Mailbox synchronous", true
|
52
|
+
end
|
53
|
+
|
54
|
+
def __create_fiber__
|
55
|
+
JRL::Fibers::ThreadFiber.new( JRL::RunnableExecutorImpl.new, "#{self.class.name} #{self.object_id} Mailbox", true )
|
53
56
|
end
|
54
57
|
|
55
58
|
def __started_fiber__
|
56
|
-
fiber = Mailbox.synchronous == true ? __synchronous_fiber__ :
|
59
|
+
fiber = Mailbox.synchronous == true ? __synchronous_fiber__ : __create_fiber__
|
57
60
|
fiber.start
|
58
61
|
fiber
|
59
62
|
end
|
@@ -64,7 +67,7 @@ module Mailbox
|
|
64
67
|
|
65
68
|
module ClassMethods
|
66
69
|
include Synchronized::ClassMethods
|
67
|
-
|
70
|
+
|
68
71
|
# Used within +Mailbox+ module
|
69
72
|
attr_accessor :__channel_registry__
|
70
73
|
|
data/mailbox.gemspec
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
# Generated by jeweler
|
2
|
-
# DO NOT EDIT THIS FILE
|
3
|
-
# Instead, edit Jeweler::Tasks in Rakefile, and run
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{mailbox}
|
8
|
-
s.version = "0.1.
|
8
|
+
s.version = "0.1.6"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Joel Friedman", "Patrick Farley"]
|
12
|
-
s.date = %q{
|
12
|
+
s.date = %q{2010-01-05}
|
13
13
|
s.description = %q{Mailbox is a JRuby module that simplifies concurrency and is backed by JVM threads.}
|
14
14
|
s.email = %q{asher.friedman@gmail.com}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -38,7 +38,7 @@ Gem::Specification.new do |s|
|
|
38
38
|
s.rdoc_options = ["--charset=UTF-8"]
|
39
39
|
s.require_paths = ["lib"]
|
40
40
|
s.rubyforge_project = %q{mailbox}
|
41
|
-
s.rubygems_version = %q{1.3.
|
41
|
+
s.rubygems_version = %q{1.3.5}
|
42
42
|
s.summary = %q{Mailbox is a JRuby module that simplifies concurrency and is backed by JVM threads.}
|
43
43
|
s.test_files = [
|
44
44
|
"test/mailbox_test.rb",
|
@@ -52,10 +52,14 @@ Gem::Specification.new do |s|
|
|
52
52
|
|
53
53
|
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
54
54
|
s.add_runtime_dependency(%q<jretlang>, [">= 0"])
|
55
|
+
s.add_development_dependency(%q<jeweler>, [">= 0"])
|
55
56
|
else
|
56
57
|
s.add_dependency(%q<jretlang>, [">= 0"])
|
58
|
+
s.add_dependency(%q<jeweler>, [">= 0"])
|
57
59
|
end
|
58
60
|
else
|
59
61
|
s.add_dependency(%q<jretlang>, [">= 0"])
|
62
|
+
s.add_dependency(%q<jeweler>, [">= 0"])
|
60
63
|
end
|
61
64
|
end
|
65
|
+
|
data/test/mailbox_test.rb
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
require 'test_helper.rb'
|
2
2
|
|
3
3
|
class MailboxTest < Test::Unit::TestCase
|
4
|
+
JThread = java.lang.Thread
|
4
5
|
|
5
6
|
def test_mailslot_causes_execution_on_separate_thread
|
6
|
-
|
7
7
|
klass = Class.new do
|
8
8
|
include Mailbox
|
9
9
|
|
10
10
|
mailslot
|
11
11
|
def test_method(latch, thread_info)
|
12
|
-
thread_info[:
|
12
|
+
thread_info[:name] = JThread.current_thread.name
|
13
13
|
latch.count_down
|
14
14
|
end
|
15
15
|
end
|
@@ -19,7 +19,7 @@ class MailboxTest < Test::Unit::TestCase
|
|
19
19
|
klass.new.test_method(latch, thread_info)
|
20
20
|
|
21
21
|
assert( latch.await( 1, Latches::TimeUnit::SECONDS ), "Timed out" )
|
22
|
-
assert_not_equal
|
22
|
+
assert_not_equal JThread.current_thread.name, thread_info[:name]
|
23
23
|
|
24
24
|
end
|
25
25
|
|
@@ -35,14 +35,14 @@ class MailboxTest < Test::Unit::TestCase
|
|
35
35
|
|
36
36
|
mailslot
|
37
37
|
def test_method(thread_info)
|
38
|
-
thread_info[:
|
38
|
+
thread_info[:name] = JThread.current_thread.name
|
39
39
|
end
|
40
40
|
|
41
41
|
end
|
42
42
|
|
43
43
|
thread_info = {}
|
44
44
|
klass.new.test_method(thread_info)
|
45
|
-
assert_equal
|
45
|
+
assert_equal JThread.current_thread.name, thread_info[:name]
|
46
46
|
ensure
|
47
47
|
Mailbox.synchronous = false;
|
48
48
|
end
|
@@ -60,7 +60,7 @@ class MailboxTest < Test::Unit::TestCase
|
|
60
60
|
|
61
61
|
mailslot :channel => :test_channel
|
62
62
|
def test_method(message)
|
63
|
-
message[:thread_info][:
|
63
|
+
message[:thread_info][:name] = JThread.current_thread.name
|
64
64
|
message[:latch].count_down
|
65
65
|
end
|
66
66
|
end
|
@@ -73,8 +73,7 @@ class MailboxTest < Test::Unit::TestCase
|
|
73
73
|
a_channel.publish :latch => latch, :thread_info => thread_info
|
74
74
|
|
75
75
|
assert latch.await( 1, Latches::TimeUnit::SECONDS ), "Timed out"
|
76
|
-
assert_not_equal
|
77
|
-
|
76
|
+
assert_not_equal JThread.current_thread.name, thread_info[:name]
|
78
77
|
end
|
79
78
|
|
80
79
|
def test_should_support_request_channels
|
metadata
CHANGED
@@ -1,85 +1,93 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
3
|
-
requirements:
|
4
|
-
- - '>='
|
5
|
-
- !ruby/object:Gem::Version
|
6
|
-
version: "0"
|
7
|
-
version:
|
8
|
-
email: asher.friedman@gmail.com
|
9
|
-
cert_chain: []
|
10
|
-
|
11
|
-
summary: Mailbox is a JRuby module that simplifies concurrency and is backed by JVM
|
12
|
-
threads.
|
13
|
-
post_install_message:
|
14
|
-
extra_rdoc_files:
|
15
|
-
- README
|
16
|
-
homepage: http://joelash.github.com/mailbox
|
17
|
-
signing_key:
|
18
2
|
name: mailbox
|
19
|
-
|
20
|
-
|
21
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.6
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Joel Friedman
|
8
|
+
- Patrick Farley
|
22
9
|
autorequire:
|
23
|
-
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
24
12
|
|
13
|
+
date: 2010-01-05 00:00:00 -06:00
|
14
|
+
default_executable:
|
15
|
+
dependencies:
|
16
|
+
- !ruby/object:Gem::Dependency
|
17
|
+
name: jretlang
|
18
|
+
type: :runtime
|
19
|
+
version_requirement:
|
20
|
+
version_requirements: !ruby/object:Gem::Requirement
|
21
|
+
requirements:
|
22
|
+
- - ">="
|
23
|
+
- !ruby/object:Gem::Version
|
24
|
+
version: "0"
|
25
|
+
version:
|
26
|
+
- !ruby/object:Gem::Dependency
|
27
|
+
name: jeweler
|
28
|
+
type: :development
|
29
|
+
version_requirement:
|
30
|
+
version_requirements: !ruby/object:Gem::Requirement
|
31
|
+
requirements:
|
32
|
+
- - ">="
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: "0"
|
35
|
+
version:
|
36
|
+
description: Mailbox is a JRuby module that simplifies concurrency and is backed by JVM threads.
|
37
|
+
email: asher.friedman@gmail.com
|
25
38
|
executables: []
|
26
39
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
40
|
+
extensions: []
|
41
|
+
|
42
|
+
extra_rdoc_files:
|
43
|
+
- README
|
31
44
|
files:
|
32
|
-
- .gitignore
|
33
|
-
- README
|
34
|
-
- Rakefile
|
35
|
-
- VERSION.yml
|
36
|
-
- example/channel_based_log_example.rb
|
37
|
-
- example/i_can_has_cheese_burger_example.rb
|
38
|
-
- example/log_example.rb
|
39
|
-
- example/parallel_each_example.rb
|
40
|
-
- example/ping_pong_example.rb
|
41
|
-
- lib/mailbox.rb
|
42
|
-
- lib/synchronized.rb
|
43
|
-
- mailbox.gemspec
|
44
|
-
- mailbox.iml
|
45
|
-
- mailbox.ipr
|
46
|
-
- test/mailbox_test.rb
|
47
|
-
- test/synchronized_test.rb
|
48
|
-
- test/test_helper.rb
|
45
|
+
- .gitignore
|
46
|
+
- README
|
47
|
+
- Rakefile
|
48
|
+
- VERSION.yml
|
49
|
+
- example/channel_based_log_example.rb
|
50
|
+
- example/i_can_has_cheese_burger_example.rb
|
51
|
+
- example/log_example.rb
|
52
|
+
- example/parallel_each_example.rb
|
53
|
+
- example/ping_pong_example.rb
|
54
|
+
- lib/mailbox.rb
|
55
|
+
- lib/synchronized.rb
|
56
|
+
- mailbox.gemspec
|
57
|
+
- mailbox.iml
|
58
|
+
- mailbox.ipr
|
59
|
+
- test/mailbox_test.rb
|
60
|
+
- test/synchronized_test.rb
|
61
|
+
- test/test_helper.rb
|
62
|
+
has_rdoc: true
|
63
|
+
homepage: http://joelash.github.com/mailbox
|
64
|
+
licenses: []
|
65
|
+
|
66
|
+
post_install_message:
|
67
|
+
rdoc_options:
|
68
|
+
- --charset=UTF-8
|
69
|
+
require_paths:
|
70
|
+
- lib
|
71
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: "0"
|
76
|
+
version:
|
49
77
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
50
78
|
requirements:
|
51
|
-
|
52
|
-
|
53
|
-
|
79
|
+
- - ">="
|
80
|
+
- !ruby/object:Gem::Version
|
81
|
+
version: "0"
|
54
82
|
version:
|
55
|
-
extensions: []
|
56
|
-
|
57
|
-
rubygems_version: 1.3.3
|
58
83
|
requirements: []
|
59
84
|
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
85
|
+
rubyforge_project: mailbox
|
86
|
+
rubygems_version: 1.3.5
|
87
|
+
signing_key:
|
88
|
+
specification_version: 3
|
89
|
+
summary: Mailbox is a JRuby module that simplifies concurrency and is backed by JVM threads.
|
65
90
|
test_files:
|
66
|
-
- test/mailbox_test.rb
|
67
|
-
- test/synchronized_test.rb
|
68
|
-
- test/test_helper.rb
|
69
|
-
version: !ruby/object:Gem::Version
|
70
|
-
version: 0.1.4
|
71
|
-
require_paths:
|
72
|
-
- lib
|
73
|
-
dependencies:
|
74
|
-
- !ruby/object:Gem::Dependency
|
75
|
-
version_requirements: !ruby/object:Gem::Requirement
|
76
|
-
requirements:
|
77
|
-
- - '>='
|
78
|
-
- !ruby/object:Gem::Version
|
79
|
-
version: "0"
|
80
|
-
version:
|
81
|
-
type: :runtime
|
82
|
-
version_requirement:
|
83
|
-
name: jretlang
|
84
|
-
bindir: bin
|
85
|
-
has_rdoc: true
|
91
|
+
- test/mailbox_test.rb
|
92
|
+
- test/synchronized_test.rb
|
93
|
+
- test/test_helper.rb
|