Class SemaphoreBackPressureHandler
java.lang.Object
io.awspring.cloud.sqs.listener.backpressure.SemaphoreBackPressureHandler
- All Implemented Interfaces:
BackPressureHandler,BatchAwareBackPressureHandler,IdentifiableContainerComponent
@Deprecated
public class SemaphoreBackPressureHandler
extends Object
implements BatchAwareBackPressureHandler, IdentifiableContainerComponent
Deprecated.
BackPressureHandler implementation that uses a Semaphore for handling backpressure.- Since:
- 3.0
- Author:
- Tomaz Fernandes
- See Also:
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from interface io.awspring.cloud.sqs.listener.backpressure.BackPressureHandler
BackPressureHandler.ReleaseReason -
Method Summary
Modifier and TypeMethodDescriptionbuilder()Deprecated.booleanDeprecated.Attempts to acquire all permits up to the specified timeout.intDeprecated.Return the configured batch size for this handler.getId()Deprecated.Get the component id.voidrelease(int amount) Deprecated.Release the specified amount of permits.voidDeprecated.Release a batch of permits.intrequest(int amount) Deprecated.Requests a number of permits.intDeprecated.Request a batch of permits.voidDeprecated.Set the component id.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.awspring.cloud.sqs.listener.backpressure.BatchAwareBackPressureHandler
release
-
Method Details
-
builder
Deprecated. -
setId
Deprecated.Description copied from interface:IdentifiableContainerComponentSet the component id.- Specified by:
setIdin interfaceIdentifiableContainerComponent- Parameters:
id- the id.
-
getId
Deprecated.Description copied from interface:IdentifiableContainerComponentGet the component id.- Specified by:
getIdin interfaceIdentifiableContainerComponent- Returns:
- the id.
-
request
Deprecated.Description copied from interface:BackPressureHandlerRequests a number of permits. Each obtained permit allows theMessageSourceto retrieve one message.- Specified by:
requestin interfaceBackPressureHandler- Parameters:
amount- the amount of permits to request.- Returns:
- the amount of permits obtained.
- Throws:
InterruptedException- if the Thread is interrupted while waiting for permits.
-
requestBatch
Deprecated.Description copied from interface:BatchAwareBackPressureHandlerRequest a batch of permits.- Specified by:
requestBatchin interfaceBatchAwareBackPressureHandler- Returns:
- the number of permits acquired.
- Throws:
InterruptedException- if the Thread is interrupted while waiting for permits.
-
releaseBatch
public void releaseBatch()Deprecated.Description copied from interface:BatchAwareBackPressureHandlerRelease a batch of permits. This has the semantics of letting theBackPressureHandlerknow that all permits from a batch are being released, in opposition toBackPressureHandler.release(int)in which any number of permits can be specified.- Specified by:
releaseBatchin interfaceBatchAwareBackPressureHandler
-
getBatchSize
public int getBatchSize()Deprecated.Description copied from interface:BatchAwareBackPressureHandlerReturn the configured batch size for this handler.- Specified by:
getBatchSizein interfaceBatchAwareBackPressureHandler- Returns:
- the batch size.
-
release
public void release(int amount) Deprecated.Description copied from interface:BackPressureHandlerRelease the specified amount of permits. Each message that has been processed should release one permit, whether processing was successful or not.- Specified by:
releasein interfaceBackPressureHandler- Parameters:
amount- the amount of permits to release.
-
drain
Deprecated.Description copied from interface:BackPressureHandlerAttempts to acquire all permits up to the specified timeout. If successful, means all permits were returned and thus no activity is left in theMessageSource.- Specified by:
drainin interfaceBackPressureHandler- Parameters:
timeout- the maximum amount of time to wait for all permits to be released.- Returns:
- whether all permits were acquired.
-