zmachine 0.4.1 → 0.4.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/java/com/liquidm/zmachine/HashedWheel.class +0 -0
- data/lib/zmachine.rb +2 -6
- data/lib/zmachine/reactor.rb +2 -26
- data/lib/zmachine/zmq_channel.rb +0 -15
- data/zmachine.gemspec +2 -2
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 678962082b59e5cd14cafa1854e9824d7b92635d
|
4
|
+
data.tar.gz: 89c609b6ea82d80371806d62974ae25baab8ad59
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 06a8730505de6a152fe7d3302b416cb040a3df5c2daa11c75ee0a3b4f4740ec44f3b013438666b63e0b3997e6b5a61fbd3ce1be5c24abac8f8917df38ac68a5d
|
7
|
+
data.tar.gz: 080046c1498d52f1052200dbfb5dcf0b80a12f357728bb9bd55fffac4bbdb2b38b2899912061658ba56d07b6917b4f393408b3c8c6997acc8619b53bc6375121
|
Binary file
|
data/lib/zmachine.rb
CHANGED
@@ -13,8 +13,8 @@ module ZMachine
|
|
13
13
|
attr_accessor :debug
|
14
14
|
end
|
15
15
|
|
16
|
-
def self.
|
17
|
-
Thread.current[:reactor] =
|
16
|
+
def self.reactor=(value)
|
17
|
+
Thread.current[:reactor] = value
|
18
18
|
end
|
19
19
|
|
20
20
|
def self.reactor
|
@@ -100,10 +100,6 @@ module ZMachine
|
|
100
100
|
reactor.stop_server(signature)
|
101
101
|
end
|
102
102
|
|
103
|
-
def self.stop
|
104
|
-
Reactor.terminate_all_reactors
|
105
|
-
end
|
106
|
-
|
107
103
|
end
|
108
104
|
|
109
105
|
if ENV['DEBUG']
|
data/lib/zmachine/reactor.rb
CHANGED
@@ -12,28 +12,6 @@ module ZMachine
|
|
12
12
|
|
13
13
|
class Reactor
|
14
14
|
|
15
|
-
@mutex = Mutex.new
|
16
|
-
|
17
|
-
def self.register_reactor(reactor)
|
18
|
-
@mutex.synchronize do
|
19
|
-
@reactors ||= []
|
20
|
-
@reactors << reactor
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
def self.terminate_all_reactors
|
25
|
-
@mutex.synchronize do
|
26
|
-
@reactors.each(&:stop_event_loop)
|
27
|
-
@reactors.clear
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
def self.unregister_reactor(reactor)
|
32
|
-
@mutex.synchronize do
|
33
|
-
@reactors.delete(reactor)
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
15
|
def initialize
|
38
16
|
@heartbeat_interval = ZMachine.heartbeat_interval || 0.5 # coarse grained by default
|
39
17
|
@next_tick_queue = ConcurrentLinkedQueue.new
|
@@ -101,7 +79,7 @@ module ZMachine
|
|
101
79
|
ZMachine.logger.debug("zmachine:reactor:#{__method__}") if ZMachine.debug
|
102
80
|
add_shutdown_hook(shutdown_hook) if shutdown_hook
|
103
81
|
begin
|
104
|
-
|
82
|
+
Signal.register_shutdown_handler { self.stop_event_loop }
|
105
83
|
@running = true
|
106
84
|
if callback = (callback || block)
|
107
85
|
add_timer(0) { callback.call(self) }
|
@@ -120,10 +98,8 @@ module ZMachine
|
|
120
98
|
@shutdown_hooks.pop.call until @shutdown_hooks.empty?
|
121
99
|
@next_tick_queue = ConcurrentLinkedQueue.new
|
122
100
|
@running = false
|
123
|
-
Reactor.unregister_reactor(self)
|
124
101
|
ZMachine.logger.debug("zmachine:reactor:#{__method__}", stop: :zcontext) if ZMachine.debug
|
125
|
-
|
126
|
-
ZMachine.clear_current_reactor
|
102
|
+
ZMachine.reactor = nil
|
127
103
|
end
|
128
104
|
end
|
129
105
|
|
data/lib/zmachine/zmq_channel.rb
CHANGED
@@ -1,21 +1,6 @@
|
|
1
1
|
require 'zmachine'
|
2
2
|
require 'zmachine/channel'
|
3
3
|
|
4
|
-
class ZMQ
|
5
|
-
class Socket
|
6
|
-
# for performance reason we alias the method here (otherwise it uses reflections all the time!)
|
7
|
-
# super ugly, since we need to dynamically infer the java class of byte[]
|
8
|
-
java_alias :send_byte_buffer, :sendByteBuffer, [Java::JavaNio::ByteBuffer.java_class, Java::int]
|
9
|
-
java_alias :send_byte_array, :send, [[].to_java(:byte).java_class, Java::int]
|
10
|
-
java_alias :recv_byte_array, :recv, [Java::int]
|
11
|
-
|
12
|
-
def write(buffer)
|
13
|
-
bytes = send_byte_buffer(buffer, 0)
|
14
|
-
buffer.position(buffer.position + bytes)
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
4
|
module ZMachine
|
20
5
|
class ZMQChannel < Channel
|
21
6
|
|
data/zmachine.gemspec
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |spec|
|
4
4
|
spec.name = "zmachine"
|
5
|
-
spec.version = "0.4.
|
5
|
+
spec.version = "0.4.2"
|
6
6
|
spec.authors = ["LiquidM, Inc."]
|
7
7
|
spec.email = ["opensource@liquidm.com"]
|
8
8
|
spec.description = %q{pure JRuby multi-threaded mostly EventMachine compatible event loop}
|
@@ -15,5 +15,5 @@ Gem::Specification.new do |spec|
|
|
15
15
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
16
16
|
spec.require_paths = ["lib"]
|
17
17
|
|
18
|
-
spec.add_dependency "liquid-ext"
|
18
|
+
spec.add_dependency "liquid-ext", ">= 3.3.8"
|
19
19
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: zmachine
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- LiquidM, Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-04-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: liquid-ext
|
@@ -16,12 +16,12 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - '>='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 3.3.8
|
20
20
|
requirement: !ruby/object:Gem::Requirement
|
21
21
|
requirements:
|
22
22
|
- - '>='
|
23
23
|
- !ruby/object:Gem::Version
|
24
|
-
version:
|
24
|
+
version: 3.3.8
|
25
25
|
prerelease: false
|
26
26
|
type: :runtime
|
27
27
|
description: pure JRuby multi-threaded mostly EventMachine compatible event loop
|