ji2p 0.0.4-universal-java-11 → 0.0.5-universal-java-11
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.
- checksums.yaml +4 -4
- data/.gitignore +11 -0
- data/.jrubyrc +54 -0
- data/Gemfile +27 -0
- data/Gemfile.lock +183 -0
- data/Mavenfile +32 -0
- data/README.md +96 -0
- data/Rakefile +49 -0
- data/bin/bundle +1 -1
- data/clean_compiled.sh +2 -0
- data/config/config.ru +7 -0
- data/config/defaults.yml +13 -0
- data/config/jvm.options +37 -0
- data/config/warble.rb +182 -0
- data/install_gems.sh +2 -0
- data/ji2p.gemspec +64 -0
- data/lib/core_ext.rb +3 -3
- data/lib/ji2p/version.rb +1 -1
- metadata +64 -61
- data/lib/actor_system/actor.rb +0 -10
- data/lib/actor_system/concurrent/processor.rb +0 -21
- data/lib/actor_system/concurrent/worker.rb +0 -13
- data/lib/actor_system/core/minimal.rb +0 -84
- data/lib/actor_system/core/observable_implementation.rb +0 -58
- data/lib/actor_system/core/props.rb +0 -45
- data/lib/actor_system/dispatcher.rb +0 -12
- data/lib/actor_system/mailbox.rb +0 -7
- data/lib/actor_system/message.rb +0 -60
- data/lib/ji2p/rspec.rb +0 -16
- data/lib/net/i2p/client/mstreaming/0.9.43/mstreaming-0.9.43.jar +0 -0
- data/lib/net/i2p/client/streaming/0.9.43/streaming-0.9.43.jar +0 -0
- data/lib/net/i2p/i2p/0.9.43/i2p-0.9.43.jar +0 -0
- data/lib/net/i2p/router/0.9.43/router-0.9.43.jar +0 -0
data/lib/actor_system/actor.rb
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
module ActorSystem
|
2
|
-
module Concurrent
|
3
|
-
class Processor
|
4
|
-
def self.start(concurrency = 1)
|
5
|
-
concurrency.times { |n| new("Processor #{n}") }
|
6
|
-
end
|
7
|
-
|
8
|
-
def initialize(name)
|
9
|
-
thread = Thread.new do
|
10
|
-
loop do
|
11
|
-
payload = Magique.backend.pop
|
12
|
-
worker_class = payload[:worker]
|
13
|
-
worker_class.new.perform(*payload[:args])
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
thread.name = name
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
@@ -1,84 +0,0 @@
|
|
1
|
-
require 'thread'
|
2
|
-
|
3
|
-
module ActorSystem
|
4
|
-
module Minimal
|
5
|
-
|
6
|
-
module Actor # To use this, you'd include Actor instead of Celluloid
|
7
|
-
module ClassMethods
|
8
|
-
def new(*args, &block)
|
9
|
-
Proxy.new(super)
|
10
|
-
end
|
11
|
-
end
|
12
|
-
|
13
|
-
class << self
|
14
|
-
def included(klass)
|
15
|
-
klass.extend(ClassMethods)
|
16
|
-
end
|
17
|
-
|
18
|
-
def current
|
19
|
-
Thread.current[:actor]
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
class Proxy
|
24
|
-
def initialize(target)
|
25
|
-
@target = target
|
26
|
-
@mailbox = Queue.new
|
27
|
-
@mutex = Mutex.new
|
28
|
-
@running = true
|
29
|
-
|
30
|
-
@async_proxy = AsyncProxy.new(self)
|
31
|
-
|
32
|
-
@thread = Thread.new do
|
33
|
-
Thread.current[:actor] = self
|
34
|
-
process_inbox
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
|
-
def async
|
39
|
-
@async_proxy
|
40
|
-
end
|
41
|
-
|
42
|
-
def send_later(meth, *args)
|
43
|
-
@mailbox << [meth, args]
|
44
|
-
end
|
45
|
-
|
46
|
-
def terminate
|
47
|
-
@running = false
|
48
|
-
end
|
49
|
-
|
50
|
-
def method_missing(meth, *args)
|
51
|
-
process_message(meth, *args)
|
52
|
-
end
|
53
|
-
|
54
|
-
private
|
55
|
-
|
56
|
-
def process_inbox
|
57
|
-
while @running
|
58
|
-
meth, args = @mailbox.pop
|
59
|
-
process_message(meth, *args)
|
60
|
-
end
|
61
|
-
|
62
|
-
rescue Exception => ex
|
63
|
-
puts "Error while running actor: #{ex}"
|
64
|
-
end
|
65
|
-
|
66
|
-
def process_message(meth, *args)
|
67
|
-
@mutex.synchronize do
|
68
|
-
@target.public_send(meth, *args)
|
69
|
-
end
|
70
|
-
end
|
71
|
-
end
|
72
|
-
|
73
|
-
class AsyncProxy
|
74
|
-
def initialize(actor)
|
75
|
-
@actor = actor
|
76
|
-
end
|
77
|
-
|
78
|
-
def method_missing(meth, *args)
|
79
|
-
@actor.send_later(meth, *args)
|
80
|
-
end
|
81
|
-
end
|
82
|
-
end
|
83
|
-
end
|
84
|
-
end
|
@@ -1,58 +0,0 @@
|
|
1
|
-
module ActorSystem
|
2
|
-
module Core
|
3
|
-
module ObservableImplementation
|
4
|
-
def observers
|
5
|
-
@observers || @observers = []
|
6
|
-
end
|
7
|
-
|
8
|
-
def notify_observers(*args)
|
9
|
-
observers.each do |observer|
|
10
|
-
mutex.synchronize do
|
11
|
-
observer.observer_update(*args) if observer.respond_to? :observer_update
|
12
|
-
end
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
|
-
def add_observer(object)
|
17
|
-
mutex.synchronize do
|
18
|
-
observers << object
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
private
|
23
|
-
|
24
|
-
def mutex
|
25
|
-
@mutex ||= Mutex.new
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
class ObservableExample
|
30
|
-
include ObservableImplementation
|
31
|
-
attr_accessor :counter
|
32
|
-
|
33
|
-
def initialize
|
34
|
-
self.counter = 0
|
35
|
-
end
|
36
|
-
|
37
|
-
def tick
|
38
|
-
self.counter += 1
|
39
|
-
notify_observers(counter)
|
40
|
-
end
|
41
|
-
end
|
42
|
-
|
43
|
-
class ObserverExample
|
44
|
-
def initialize(observable)
|
45
|
-
observable.add_observer(self)
|
46
|
-
end
|
47
|
-
|
48
|
-
def observer_update(counter)
|
49
|
-
puts "Count has increased by: #{counter}"
|
50
|
-
end
|
51
|
-
end
|
52
|
-
|
53
|
-
# observable = Observable.new
|
54
|
-
# observer1 = Observer.new(observable)
|
55
|
-
# observer2 = Observer.new(observable)
|
56
|
-
# observable.tick
|
57
|
-
end
|
58
|
-
end
|
@@ -1,45 +0,0 @@
|
|
1
|
-
require_relative 'observable_implementation.rb'
|
2
|
-
|
3
|
-
module ActorSystem
|
4
|
-
module Core
|
5
|
-
class Prop
|
6
|
-
include ObservableImplementation
|
7
|
-
|
8
|
-
def initialize name, value
|
9
|
-
@name = name
|
10
|
-
@value = value
|
11
|
-
end
|
12
|
-
|
13
|
-
def value= value
|
14
|
-
@value = value
|
15
|
-
notify_observers(value)
|
16
|
-
end
|
17
|
-
end
|
18
|
-
class BasicObserverHash
|
19
|
-
def initialize values={}
|
20
|
-
@internal_hash = values
|
21
|
-
end
|
22
|
-
|
23
|
-
def [](key)
|
24
|
-
@internal_hash[key]
|
25
|
-
end
|
26
|
-
|
27
|
-
def []=(key, value)
|
28
|
-
if @internal_hash[key].nil?
|
29
|
-
p = Prop.new key,value
|
30
|
-
p.add_observer self
|
31
|
-
@internal_hash[key] = p
|
32
|
-
else
|
33
|
-
@internal_hash[key].value = value
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
|
-
def observer_update value
|
38
|
-
puts "Received update = #{value}"
|
39
|
-
end
|
40
|
-
end
|
41
|
-
|
42
|
-
class Props < BasicObserverHash
|
43
|
-
end
|
44
|
-
end
|
45
|
-
end
|
data/lib/actor_system/mailbox.rb
DELETED
data/lib/actor_system/message.rb
DELETED
@@ -1,60 +0,0 @@
|
|
1
|
-
module ActorSystem
|
2
|
-
module Message
|
3
|
-
def self.included cls
|
4
|
-
cls.class_exec do
|
5
|
-
extend Matcher
|
6
|
-
|
7
|
-
include MessageName
|
8
|
-
end
|
9
|
-
end
|
10
|
-
|
11
|
-
def self.extended receiver
|
12
|
-
receiver.instance_exec do
|
13
|
-
extend Matcher
|
14
|
-
extend MessageName
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
def self.=== object
|
19
|
-
if object.is_a? Symbol
|
20
|
-
true
|
21
|
-
else
|
22
|
-
super
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
module Matcher
|
27
|
-
def === other
|
28
|
-
other_message_name = Name.get other
|
29
|
-
|
30
|
-
message_name == other_message_name
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
module MessageName
|
35
|
-
def self.included cls
|
36
|
-
cls.class_exec do
|
37
|
-
extend ClassMethod
|
38
|
-
|
39
|
-
include InstanceMethod
|
40
|
-
end
|
41
|
-
end
|
42
|
-
|
43
|
-
def self.extended receiver
|
44
|
-
receiver.extend ClassMethod
|
45
|
-
end
|
46
|
-
|
47
|
-
module InstanceMethod
|
48
|
-
def message_name
|
49
|
-
self.class.message_name
|
50
|
-
end
|
51
|
-
end
|
52
|
-
|
53
|
-
module ClassMethod
|
54
|
-
def message_name
|
55
|
-
Name.get name
|
56
|
-
end
|
57
|
-
end
|
58
|
-
end
|
59
|
-
end
|
60
|
-
end
|
data/lib/ji2p/rspec.rb
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
require_relative 'environment'
|
2
|
-
Ji2p::Bundler.setup!({:without => [:build]})
|
3
|
-
require 'ji2p'
|
4
|
-
|
5
|
-
$LOAD_PATH.unshift(File.join(Ji2p::Environment::JI2P_CORE, "spec"))
|
6
|
-
|
7
|
-
require 'rspec/core'
|
8
|
-
require 'rspec'
|
9
|
-
|
10
|
-
RSpec.world.reset # if multiple rspec runs occur in a single process, the RSpec "world" state needs to be reset.
|
11
|
-
|
12
|
-
status = RSpec::Core::Runner.run(ARGV.empty? ? ($JUNIT_ARGV || ["spec"]) : ARGV).to_i
|
13
|
-
if ENV["IS_JUNIT_RUN"]
|
14
|
-
return status
|
15
|
-
end
|
16
|
-
exit status if status != 0
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|