odba 1.0.7 → 1.0.8

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,7 @@
1
+ === 1.0.8 / 09.01.2012
2
+
3
+ * Added exclusive control to update @accessed_by Hash variable in CacheEntry class using mutex (Patinfo-Invoice Error)
4
+
1
5
  === 1.0.7 / 27.12.2011
2
6
 
3
7
  * Debugged Hash iteration error during cleaning @fetched and @prefetched objects
@@ -0,0 +1,39 @@
1
+ Guide.txt
2
+ History.txt
3
+ LICENSE.txt
4
+ Manifest.txt
5
+ README.txt
6
+ Rakefile
7
+ install.rb
8
+ lib/odba.rb
9
+ lib/odba/18_19_loading_compatibility.rb
10
+ lib/odba/cache.rb
11
+ lib/odba/cache_entry.rb
12
+ lib/odba/connection_pool.rb
13
+ lib/odba/drbwrapper.rb
14
+ lib/odba/id_server.rb
15
+ lib/odba/index.rb
16
+ lib/odba/index_definition.rb
17
+ lib/odba/marshal.rb
18
+ lib/odba/odba.rb
19
+ lib/odba/odba_error.rb
20
+ lib/odba/persistable.rb
21
+ lib/odba/storage.rb
22
+ lib/odba/stub.rb
23
+ sql/collection.sql
24
+ sql/create_tables.sql
25
+ sql/object.sql
26
+ sql/object_connection.sql
27
+ test/suite.rb
28
+ test/test_array.rb
29
+ test/test_cache.rb
30
+ test/test_cache_entry.rb
31
+ test/test_connection_pool.rb
32
+ test/test_drbwrapper.rb
33
+ test/test_hash.rb
34
+ test/test_id_server.rb
35
+ test/test_index.rb
36
+ test/test_marshal.rb
37
+ test/test_persistable.rb
38
+ test/test_storage.rb
39
+ test/test_stub.rb
@@ -11,5 +11,5 @@ require 'odba/index'
11
11
  require 'odba/odba'
12
12
 
13
13
  class Odba
14
- VERSION = '1.0.7'
14
+ VERSION = '1.0.8'
15
15
  end
@@ -1,5 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
- #-- CacheEntry -- odba -- 29.04.2004 -- hwyss@ywesee.com mwalder@ywesee.com
2
+ # encoding: utf-8
3
+ # ODBA::CacheEntry -- odba -- 09.01.2012 -- mhatakeyama@ywesee.com
4
+ # ODBA::CacheEntry -- odba -- 29.04.2004 -- hwyss@ywesee.com mwalder@ywesee.com
3
5
 
4
6
  module ODBA
5
7
  class CacheEntry # :nodoc: all
@@ -16,6 +18,7 @@ module ODBA
16
18
  update obj
17
19
  @accessed_by = {}
18
20
  @odba_observers = obj.odba_observers
21
+ @cache_entry_mutex = Mutex.new
19
22
  end
20
23
  def update obj
21
24
  @last_access = Time.now
@@ -42,16 +45,20 @@ module ODBA
42
45
  odba_id && ODBA.cache.include?(odba_id) && ODBA.cache.fetch(odba_id)
43
46
  end
44
47
  def odba_add_reference(object)
45
- @accessed_by.store(object.object_id, object.odba_id)
48
+ @cache_entry_mutex.synchronize do
49
+ @accessed_by.store(object.object_id, object.odba_id)
50
+ end
46
51
  object
47
52
  end
48
53
  def odba_cut_connections!
49
- @accessed_by.each { |object_id, odba_id|
50
- if((item = odba_id2ref(odba_id) || object_id2ref(object_id, odba_id)) \
51
- && item.respond_to?(:odba_cut_connection))
52
- item.odba_cut_connection(_odba_object)
53
- end
54
- }
54
+ @cache_entry_mutex.synchronize do
55
+ @accessed_by.each { |object_id, odba_id|
56
+ if((item = odba_id2ref(odba_id) || object_id2ref(object_id, odba_id)) \
57
+ && item.respond_to?(:odba_cut_connection))
58
+ item.odba_cut_connection(_odba_object)
59
+ end
60
+ }
61
+ end
55
62
  end
56
63
  def odba_notify_observers(*args)
57
64
  @odba_observers.each { |obs| obs.odba_update(*args) }
@@ -72,12 +79,14 @@ module ODBA
72
79
  # replace with stubs in accessed_by
73
80
  instance = _odba_object
74
81
  if opts[:force]
75
- @accessed_by.each do |object_id, odba_id|
76
- if item = odba_id2ref(odba_id)
77
- item.odba_stubize instance, opts
78
- elsif(item = object_id2ref(object_id, odba_id))
79
- if item.is_a?(Persistable) && !item.is_a?(Stub)
82
+ @cache_entry_mutex.synchronize do
83
+ @accessed_by.each do |object_id, odba_id|
84
+ if item = odba_id2ref(odba_id)
80
85
  item.odba_stubize instance, opts
86
+ elsif(item = object_id2ref(object_id, odba_id))
87
+ if item.is_a?(Persistable) && !item.is_a?(Stub)
88
+ item.odba_stubize instance, opts
89
+ end
81
90
  end
82
91
  end
83
92
  end
@@ -111,11 +120,13 @@ module ODBA
111
120
  oldhash = _odba_object.hash
112
121
  _odba_object.odba_replace!(obj)
113
122
  if(_odba_object.hash != oldhash)
114
- @accessed_by.each { |object_id, odba_id|
115
- if(item = odba_id2ref(odba_id) || object_id2ref(object_id, odba_id))
116
- item.rehash if(item.respond_to? :rehash)
117
- end
118
- }
123
+ @cache_entry_mutex.synchronize do
124
+ @accessed_by.each { |object_id, odba_id|
125
+ if(item = odba_id2ref(odba_id) || object_id2ref(object_id, odba_id))
126
+ item.rehash if(item.respond_to? :rehash)
127
+ end
128
+ }
129
+ end
119
130
  end
120
131
  end
121
132
  end
metadata CHANGED
@@ -1,12 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: odba
3
3
  version: !ruby/object:Gem::Version
4
- prerelease: false
4
+ hash: 7
5
+ prerelease:
5
6
  segments:
6
7
  - 1
7
8
  - 0
8
- - 7
9
- version: 1.0.7
9
+ - 8
10
+ version: 1.0.8
10
11
  platform: ruby
11
12
  authors:
12
13
  - Masaomi Hatakeyama, Zeno R.R. Davatz
@@ -14,16 +15,18 @@ autorequire:
14
15
  bindir: bin
15
16
  cert_chain: []
16
17
 
17
- date: 2011-12-27 00:00:00 +01:00
18
+ date: 2012-01-09 00:00:00 +01:00
18
19
  default_executable:
19
20
  dependencies:
20
21
  - !ruby/object:Gem::Dependency
21
22
  name: hoe
22
23
  prerelease: false
23
24
  requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
24
26
  requirements:
25
27
  - - ">="
26
28
  - !ruby/object:Gem::Version
29
+ hash: 41
27
30
  segments:
28
31
  - 2
29
32
  - 9
@@ -42,11 +45,13 @@ extra_rdoc_files:
42
45
  - Guide.txt
43
46
  - History.txt
44
47
  - LICENSE.txt
48
+ - Manifest.txt
45
49
  - README.txt
46
50
  files:
47
51
  - Guide.txt
48
52
  - History.txt
49
53
  - LICENSE.txt
54
+ - Manifest.txt
50
55
  - README.txt
51
56
  - Rakefile
52
57
  - install.rb
@@ -94,23 +99,27 @@ rdoc_options:
94
99
  require_paths:
95
100
  - lib
96
101
  required_ruby_version: !ruby/object:Gem::Requirement
102
+ none: false
97
103
  requirements:
98
104
  - - ">="
99
105
  - !ruby/object:Gem::Version
106
+ hash: 3
100
107
  segments:
101
108
  - 0
102
109
  version: "0"
103
110
  required_rubygems_version: !ruby/object:Gem::Requirement
111
+ none: false
104
112
  requirements:
105
113
  - - ">="
106
114
  - !ruby/object:Gem::Version
115
+ hash: 3
107
116
  segments:
108
117
  - 0
109
118
  version: "0"
110
119
  requirements: []
111
120
 
112
121
  rubyforge_project: odba
113
- rubygems_version: 1.3.6
122
+ rubygems_version: 1.4.2
114
123
  signing_key:
115
124
  specification_version: 3
116
125
  summary: Object Database Access - Ruby Software for ODDB.org Memory Management