Bulkhead.BulkheadFuture<T>, Bulkhead.EventPublisher, Bulkhead.Metrics| Constructor and Description |
|---|
SemaphoreBulkhead(java.lang.String name)
Creates a bulkhead with a default config.
|
SemaphoreBulkhead(java.lang.String name,
BulkheadConfig bulkheadConfig)
Creates a bulkhead using a configuration supplied
|
SemaphoreBulkhead(java.lang.String name,
BulkheadConfig bulkheadConfig,
io.vavr.collection.Map<java.lang.String,java.lang.String> tags)
Creates a bulkhead using a configuration supplied
|
SemaphoreBulkhead(java.lang.String name,
java.util.function.Supplier<BulkheadConfig> configSupplier)
Create a bulkhead using a configuration supplier
|
SemaphoreBulkhead(java.lang.String name,
java.util.function.Supplier<BulkheadConfig> configSupplier,
io.vavr.collection.Map<java.lang.String,java.lang.String> tags)
Create a bulkhead using a configuration supplier
|
| Modifier and Type | Method and Description |
|---|---|
void |
acquirePermission()
Acquires a permission to execute a call, only if one is available at the time of invocation
If the current thread is interrupted while waiting for a permit
then it won't throw InterruptedException, but its interrupt status will be set.
|
void |
changeConfig(BulkheadConfig newConfig)
Dynamic bulkhead configuration change.
|
BulkheadConfig |
getBulkheadConfig()
Returns the BulkheadConfig of this Bulkhead.
|
Bulkhead.EventPublisher |
getEventPublisher()
Returns an EventPublisher which subscribes to the reactive stream of BulkheadEvent and can be
used to register event consumers.
|
Bulkhead.Metrics |
getMetrics()
Get the Metrics of this Bulkhead.
|
java.lang.String |
getName()
Returns the name of this bulkhead.
|
io.vavr.collection.Map<java.lang.String,java.lang.String> |
getTags()
Returns an unmodifiable map with tags assigned to this Bulkhead.
|
void |
onComplete()
Records a completed call and releases a permission.
|
void |
releasePermission()
Releases a permission and increases the number of available permits by one.
|
java.lang.String |
toString() |
boolean |
tryAcquirePermission()
Acquires a permission to execute a call, only if one is available at the time of invocation.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitdecorateCallable, decorateCheckedConsumer, decorateCheckedFunction, decorateCheckedRunnable, decorateCheckedSupplier, decorateCompletionStage, decorateConsumer, decorateEitherSupplier, decorateFunction, decorateFuture, decorateRunnable, decorateSupplier, decorateTrySupplier, executeCallable, executeCheckedSupplier, executeCompletionStage, executeEitherSupplier, executeRunnable, executeSupplier, executeTrySupplier, of, of, of, of, ofDefaultspublic SemaphoreBulkhead(java.lang.String name,
@Nullable
BulkheadConfig bulkheadConfig)
name - the name of this bulkheadbulkheadConfig - custom bulkhead configurationpublic SemaphoreBulkhead(java.lang.String name,
@Nullable
BulkheadConfig bulkheadConfig,
io.vavr.collection.Map<java.lang.String,java.lang.String> tags)
name - the name of this bulkheadbulkheadConfig - custom bulkhead configurationtags - the tags to add to the Bulkheadpublic SemaphoreBulkhead(java.lang.String name)
name - the name of this bulkheadpublic SemaphoreBulkhead(java.lang.String name,
java.util.function.Supplier<BulkheadConfig> configSupplier)
name - the name of this bulkheadconfigSupplier - BulkheadConfig supplierpublic SemaphoreBulkhead(java.lang.String name,
java.util.function.Supplier<BulkheadConfig> configSupplier,
io.vavr.collection.Map<java.lang.String,java.lang.String> tags)
name - the name of this bulkheadconfigSupplier - BulkheadConfig suppliertags - tags to add to the Bulkheadpublic void changeConfig(BulkheadConfig newConfig)
changeConfig in interface BulkheadnewConfig - new BulkheadConfigpublic boolean tryAcquirePermission()
tryAcquirePermission in interface Bulkheadtrue if a permission was acquired and false otherwisepublic void acquirePermission()
acquirePermission in interface Bulkheadpublic void releasePermission()
Should only be used when a permission was acquired but not used. Otherwise use Bulkhead.onComplete() to signal a completed call and release a permission.
releasePermission in interface Bulkheadpublic void onComplete()
onComplete in interface Bulkheadpublic java.lang.String getName()
public BulkheadConfig getBulkheadConfig()
getBulkheadConfig in interface Bulkheadpublic Bulkhead.Metrics getMetrics()
getMetrics in interface Bulkheadpublic io.vavr.collection.Map<java.lang.String,java.lang.String> getTags()
public Bulkhead.EventPublisher getEventPublisher()
getEventPublisher in interface Bulkheadpublic java.lang.String toString()
toString in class java.lang.Object