weakling 0.0.4-java → 0.0.5.pre3-java
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/HISTORY.txt +4 -0
- data/Rakefile +1 -1
- data/ext/RefqueueService.class +0 -0
- data/ext/org/jruby/ext/RefQueueLibrary$1.class +0 -0
- data/ext/org/jruby/ext/RefQueueLibrary$2.class +0 -0
- data/ext/org/jruby/ext/RefQueueLibrary$RefQueue.class +0 -0
- data/ext/org/jruby/ext/RefQueueLibrary$RubyWeakReference.class +0 -0
- data/ext/org/jruby/ext/RefQueueLibrary$WeakRef.class +0 -0
- data/ext/org/jruby/ext/RefQueueLibrary.class +0 -0
- data/lib/refqueue.jar +0 -0
- data/spec/idhash_spec.rb +30 -0
- data/spec/weakref_spec.rb +42 -0
- data/weakling.gemspec +4 -4
- metadata +50 -61
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: c5c035401449cb30c14486c8e721fcfba95d687d8ff580f96caf52f0a32a58e9
|
4
|
+
data.tar.gz: bef68695fab647da861b4b0444e484c09d6cd7b30a7f8d4cd1783de4ec2047df
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 4913a685612cecdcea7adb1705f34ba6ada7d320db58a655be2f2d9f61c844f8f8b294dc00dd974967f11f03686a312185f8fcfb36434dfbf5f5b22536413656
|
7
|
+
data.tar.gz: 129af1005d41a4063d9a4a25327a2c61c210e0e13a8f3b3df32ab3a394dca810c665c7cf4665c799edfc2fb29a347f70f20c4d4b5840488c6fbd1acff7dc2b27
|
data/HISTORY.txt
CHANGED
data/Rakefile
CHANGED
@@ -11,7 +11,7 @@ end
|
|
11
11
|
desc "Compile the extension"
|
12
12
|
task :compile => "pkg/classes" do |t|
|
13
13
|
ant.javac :srcdir => "ext", :destdir => t.prerequisites.first,
|
14
|
-
:source => "
|
14
|
+
:source => "7", :target => "7", :debug => true,
|
15
15
|
:classpath => "${java.class.path}:${sun.boot.class.path}"
|
16
16
|
end
|
17
17
|
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
data/lib/refqueue.jar
CHANGED
Binary file
|
data/spec/idhash_spec.rb
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
require "weakling"
|
2
|
+
require "jruby"
|
3
|
+
|
4
|
+
describe Weakling::IdHash do
|
5
|
+
before(:each) do
|
6
|
+
@id_hash = Weakling::IdHash.new
|
7
|
+
end
|
8
|
+
|
9
|
+
it "should hold mappings from id to object" do
|
10
|
+
ary = (1..10).to_a.map {Object.new}
|
11
|
+
ids = ary.map {|o| @id_hash.add(o)}
|
12
|
+
|
13
|
+
ids.each do |id|
|
14
|
+
@id_hash[id].should_not == nil
|
15
|
+
ary.should include(@id_hash[id])
|
16
|
+
end
|
17
|
+
ids.sort.should == ary.map(&:__id__).sort
|
18
|
+
@id_hash.to_a.sort.should == ary.map{|obj| [obj.__id__, obj]}.sort
|
19
|
+
end
|
20
|
+
|
21
|
+
it "should weakly reference the objects" do
|
22
|
+
ary = (1..10).to_a.map {Object.new}
|
23
|
+
ids = ary.map {|o| @id_hash.add(o)}
|
24
|
+
ary = nil
|
25
|
+
|
26
|
+
JRuby.gc
|
27
|
+
|
28
|
+
@id_hash.to_a.should be_empty
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
require 'weakling'
|
2
|
+
require 'jruby'
|
3
|
+
|
4
|
+
describe Weakling::WeakRef do
|
5
|
+
it "holds a reference to an object" do
|
6
|
+
o = Object.new
|
7
|
+
w = Weakling::WeakRef.new(o)
|
8
|
+
w.get.should equal(o)
|
9
|
+
end
|
10
|
+
|
11
|
+
it "weakly references the contained object" do
|
12
|
+
o = Object.new
|
13
|
+
w = Weakling::WeakRef.new(o)
|
14
|
+
o = nil
|
15
|
+
5.times {JRuby.gc}
|
16
|
+
|
17
|
+
lambda {w.get}.should raise_error RefError
|
18
|
+
w.weakref_alive?.should == false
|
19
|
+
end
|
20
|
+
|
21
|
+
it "accepts a RefQueue for reporting collected refs" do
|
22
|
+
o1 = Object.new
|
23
|
+
o2 = Object.new
|
24
|
+
r = Weakling::RefQueue.new
|
25
|
+
w1 = Weakling::WeakRef.new(o1, r)
|
26
|
+
w2 = Weakling::WeakRef.new(o2, r)
|
27
|
+
|
28
|
+
r.poll.should == nil
|
29
|
+
r.remove(50).should == nil
|
30
|
+
|
31
|
+
o1 = nil
|
32
|
+
5.times {JRuby.gc}
|
33
|
+
|
34
|
+
r.poll.should == w1
|
35
|
+
|
36
|
+
o2 = nil
|
37
|
+
5.times {JRuby.gc}
|
38
|
+
|
39
|
+
r.remove.should == w2
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
data/weakling.gemspec
CHANGED
@@ -2,15 +2,15 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = %q{weakling}
|
5
|
-
s.version = "0.0.
|
5
|
+
s.version = "0.0.5.pre3"
|
6
6
|
s.authors = ["Charles Oliver Nutter"]
|
7
|
-
s.date = Time.now.strftime('
|
7
|
+
s.date = Time.now.strftime('%Y-%m-%d')
|
8
8
|
s.description = "A modified WeakRef impl for JRuby plus some weakref-related tools"
|
9
9
|
s.email = ["headius@headius.com"]
|
10
|
-
s.files = Dir['{lib,ext,examples,
|
10
|
+
s.files = Dir['{lib,ext,examples,spec}/**/*'] + Dir['{*.txt,*.gemspec,Rakefile}']
|
11
11
|
s.homepage = "http://github.com/headius/weakling"
|
12
12
|
s.require_paths = ["lib"]
|
13
13
|
s.summary = "A modified WeakRef impl for JRuby plus some weakref-related tools"
|
14
|
-
s.test_files = Dir["
|
14
|
+
s.test_files = Dir["spec/*_spec.rb"]
|
15
15
|
s.platform = "java"
|
16
16
|
end
|
metadata
CHANGED
@@ -1,75 +1,64 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: weakling
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
segments:
|
6
|
-
- 0
|
7
|
-
- 0
|
8
|
-
- 4
|
9
|
-
version: 0.0.4
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.5.pre3
|
10
5
|
platform: java
|
11
|
-
authors:
|
12
|
-
|
13
|
-
autorequire:
|
6
|
+
authors:
|
7
|
+
- Charles Oliver Nutter
|
8
|
+
autorequire:
|
14
9
|
bindir: bin
|
15
10
|
cert_chain: []
|
16
|
-
|
17
|
-
date: 2010-06-03 18:51:00.994000 -05:00
|
18
|
-
default_executable:
|
11
|
+
date: 2021-10-12 00:00:00.000000000 Z
|
19
12
|
dependencies: []
|
20
|
-
|
21
13
|
description: A modified WeakRef impl for JRuby plus some weakref-related tools
|
22
|
-
email:
|
23
|
-
|
14
|
+
email:
|
15
|
+
- headius@headius.com
|
24
16
|
executables: []
|
25
|
-
|
26
17
|
extensions: []
|
27
|
-
|
28
18
|
extra_rdoc_files: []
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
19
|
+
files:
|
20
|
+
- HISTORY.txt
|
21
|
+
- README.txt
|
22
|
+
- Rakefile
|
23
|
+
- examples/id_hash.rb
|
24
|
+
- examples/refqueue_use.rb
|
25
|
+
- ext/RefqueueService.class
|
26
|
+
- ext/RefqueueService.java
|
27
|
+
- ext/org/jruby/ext/RefQueueLibrary$1.class
|
28
|
+
- ext/org/jruby/ext/RefQueueLibrary$2.class
|
29
|
+
- ext/org/jruby/ext/RefQueueLibrary$RefQueue.class
|
30
|
+
- ext/org/jruby/ext/RefQueueLibrary$RubyWeakReference.class
|
31
|
+
- ext/org/jruby/ext/RefQueueLibrary$WeakRef.class
|
32
|
+
- ext/org/jruby/ext/RefQueueLibrary.class
|
33
|
+
- ext/org/jruby/ext/RefQueueLibrary.java
|
34
|
+
- lib/refqueue.jar
|
35
|
+
- lib/weakling.rb
|
36
|
+
- lib/weakling/collections.rb
|
37
|
+
- spec/idhash_spec.rb
|
38
|
+
- spec/weakref_spec.rb
|
39
|
+
- weakling.gemspec
|
43
40
|
homepage: http://github.com/headius/weakling
|
44
41
|
licenses: []
|
45
|
-
|
46
|
-
post_install_message:
|
42
|
+
metadata: {}
|
43
|
+
post_install_message:
|
47
44
|
rdoc_options: []
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
none: false
|
61
|
-
requirements:
|
62
|
-
- - ">="
|
63
|
-
- !ruby/object:Gem::Version
|
64
|
-
segments:
|
65
|
-
- 0
|
66
|
-
version: "0"
|
45
|
+
require_paths:
|
46
|
+
- lib
|
47
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
48
|
+
requirements:
|
49
|
+
- - ">="
|
50
|
+
- !ruby/object:Gem::Version
|
51
|
+
version: '0'
|
52
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
53
|
+
requirements:
|
54
|
+
- - ">"
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
version: 1.3.1
|
67
57
|
requirements: []
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
signing_key:
|
72
|
-
specification_version: 3
|
58
|
+
rubygems_version: 3.2.14
|
59
|
+
signing_key:
|
60
|
+
specification_version: 4
|
73
61
|
summary: A modified WeakRef impl for JRuby plus some weakref-related tools
|
74
|
-
test_files:
|
75
|
-
|
62
|
+
test_files:
|
63
|
+
- spec/idhash_spec.rb
|
64
|
+
- spec/weakref_spec.rb
|