Exception: CountingSemaphore::LeaseTimeout

Inherits:
StandardError
  • Object
show all
Defined in:
lib/counting_semaphore.rb

Overview

Custom exception raised when a semaphore lease cannot be acquired within the specified timeout. Contains information about the failed acquisition attempt including the semaphore instance, number of permits requested, and the timeout duration.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(permit_count, timeout_seconds, semaphore = nil) ⇒ LeaseTimeout

Creates a new LeaseTimeout exception.

Parameters:



41
42
43
44
45
46
# File 'lib/counting_semaphore.rb', line 41

def initialize(permit_count, timeout_seconds, semaphore = nil)
  @permit_count = permit_count
  @timeout_seconds = timeout_seconds
  @semaphore = semaphore
  super("Failed to acquire #{permit_count} permits within #{timeout_seconds} seconds")
end

Instance Attribute Details

#permit_countCountingSemaphore::LocalSemaphore, ... (readonly) Also known as: token_count

Returns:



31
32
33
# File 'lib/counting_semaphore.rb', line 31

def permit_count
  @permit_count
end

#semaphoreCountingSemaphore::LocalSemaphore, ... (readonly)

Returns:



31
32
33
# File 'lib/counting_semaphore.rb', line 31

def semaphore
  @semaphore
end

#timeout_secondsCountingSemaphore::LocalSemaphore, ... (readonly)

Returns:



31
32
33
# File 'lib/counting_semaphore.rb', line 31

def timeout_seconds
  @timeout_seconds
end