Class: ApolloStudioTracing::ShutdownBarrier

Inherits:
Object
  • Object
show all
Defined in:
lib/apollo-studio-tracing/shutdown_barrier.rb

Instance Method Summary collapse

Constructor Details

#initializeShutdownBarrier

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

#shutdownObject



15
16
17
# File 'lib/apollo-studio-tracing/shutdown_barrier.rb', line 15

def shutdown
  @latch.count_down
end

#shutting_down?Boolean

Returns:

  • (Boolean)


19
20
21
# File 'lib/apollo-studio-tracing/shutdown_barrier.rb', line 19

def shutting_down?
  @latch.count.zero?
end