Add thread_safe for handling the @children inside of Hermann::Producer

This isn't comprehensive, still debating a comprehensive approach to #50 that
I'm happy with

References #50
This commit is contained in:
R. Tyler Croy 2014-10-28 18:00:29 -07:00
parent 0cd921298e
commit 7e8fbca79e
2 changed files with 4 additions and 2 deletions

View File

@ -25,6 +25,7 @@ Gem::Specification.new do |s|
s.add_dependency 'concurrent-ruby', '~> 0.7.0'
s.add_dependency "zk", "~> 1.9.4"
s.add_dependency 'thread_safe', '~> 0.3.4'
if RUBY_PLATFORM == "java"
#IMPORTANT: make sure that jar-dependencies is only a development dependency of your gem. if it is a runtime dependencies the require_jars file will be overwritten during installation.

View File

@ -1,7 +1,8 @@
require 'thread_safe'
require 'hermann'
require 'hermann/result'
if RUBY_PLATFORM == "java"
require 'hermann/provider/java_producer'
else
@ -26,7 +27,7 @@ module Hermann
end
# We're tracking children so we can make sure that at Producer exit we
# make a reasonable attempt to clean up outstanding result objects
@children = []
@children = ThreadSafe::Array.new
end
# @return [Boolean] True if our underlying producer object thinks it's