Sha256: edbbde36d78de6edf8adb06558f34276da995925bad979db5089db0a9a632f6d
Contents?: true
Size: 998 Bytes
Versions: 2
Compression:
Stored size: 998 Bytes
Contents
module Druid module Writer module Tranquilizer class Future AWAIT = com.twitter.util.Awaitable::CanAwait WAIT_TIME = 20 attr_reader :future delegate :isDefined, to: :future def initialize(future) @future = future end def failure?(wait_time = WAIT_TIME) begin future.ready(build_duration(wait_time), AWAIT).isThrow rescue Java::ComTwitterUtil::TimeoutException => e raise Druid::ConnectionError, 'Future timed out.' end end def success?(wait_time = WAIT_TIME) begin future.ready(build_duration(wait_time), AWAIT).isReturn rescue Java::ComTwitterUtil::TimeoutException => e raise Druid::ConnectionError, 'Future timed out.' end end private def build_duration(duration) com.twitter.util.Duration.fromSeconds(duration) end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
jruby-druid-1.0.0.pre.rc4 | lib/druid/writer/tranquilizer/future.rb |
jruby-druid-1.0.0.pre.rc3 | lib/druid/writer/tranquilizer/future.rb |