Class: ApolloStudioTracing::ShutdownBarrier
- Inherits:
-
Object
- Object
- ApolloStudioTracing::ShutdownBarrier
- Defined in:
- lib/apollo-studio-tracing/shutdown_barrier.rb
Instance Method Summary collapse
- #await_shutdown(timeout_secs) ⇒ Object
-
#initialize ⇒ ShutdownBarrier
constructor
A new instance of ShutdownBarrier.
- #shutdown ⇒ Object
- #shutting_down? ⇒ Boolean
Constructor Details
#initialize ⇒ ShutdownBarrier
Returns a new instance of ShutdownBarrier.
7 8 9 |
# File 'lib/apollo-studio-tracing/shutdown_barrier.rb', line 7 def initialize @latch = Concurrent::CountDownLatch.new(1) end |
Instance Method Details
#await_shutdown(timeout_secs) ⇒ Object
11 12 13 |
# File 'lib/apollo-studio-tracing/shutdown_barrier.rb', line 11 def await_shutdown(timeout_secs) @latch.wait(timeout_secs) end |
#shutdown ⇒ Object
15 16 17 |
# File 'lib/apollo-studio-tracing/shutdown_barrier.rb', line 15 def shutdown @latch.count_down end |
#shutting_down? ⇒ Boolean
19 20 21 |
# File 'lib/apollo-studio-tracing/shutdown_barrier.rb', line 19 def shutting_down? @latch.count.zero? end |