Exception: CountingSemaphore::LeaseTimeout
- Inherits:
-
StandardError
- Object
- StandardError
- CountingSemaphore::LeaseTimeout
- 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
- #permit_count ⇒ CountingSemaphore::LocalSemaphore, ... (also: #token_count) readonly
- #semaphore ⇒ CountingSemaphore::LocalSemaphore, ... readonly
- #timeout_seconds ⇒ CountingSemaphore::LocalSemaphore, ... readonly
Instance Method Summary collapse
-
#initialize(permit_count, timeout_seconds, semaphore = nil) ⇒ LeaseTimeout
constructor
Creates a new LeaseTimeout exception.
Constructor Details
#initialize(permit_count, timeout_seconds, semaphore = nil) ⇒ LeaseTimeout
Creates a new LeaseTimeout exception.
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_count ⇒ CountingSemaphore::LocalSemaphore, ... (readonly) Also known as: token_count
31 32 33 |
# File 'lib/counting_semaphore.rb', line 31 def permit_count @permit_count end |
#semaphore ⇒ CountingSemaphore::LocalSemaphore, ... (readonly)
31 32 33 |
# File 'lib/counting_semaphore.rb', line 31 def semaphore @semaphore end |
#timeout_seconds ⇒ CountingSemaphore::LocalSemaphore, ... (readonly)
31 32 33 |
# File 'lib/counting_semaphore.rb', line 31 def timeout_seconds @timeout_seconds end |