Sha256: 44e94131804bf23e2dee24c0d2683a6dd62f078f0dfb3c4f01f5c6c7ea739f59
Contents?: true
Size: 830 Bytes
Versions: 2
Compression:
Stored size: 830 Bytes
Contents
class MyBean include Rumx::Bean bean_attr_accessor :sleep_time, :float, 'Amount of time my measured block sleeps' bean_attr_accessor :percent_failure, :integer, 'Percentage of time the measured block will fail' bean_attr_embed :timer, 'Timer for our sleep action' def initialize @sleep_time = 0.5 @percent_failure = 10 @timer = Rumx::Beans::Timer.new(:max_errors => 5) Thread.new do while true begin @timer.measure do if rand(100) < @percent_failure raise "Failure occurred with sleep_time=#{@sleep_time} and percent failure=#{@percent_failure}" end sleep @sleep_time end rescue Exception => e # Error handling... end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
rumx-0.0.2 | examples/timer/my_bean.rb |
rumx-0.0.1 | examples/timer/my_bean.rb |