K - the type of keys in the external storagepublic interface RemoteBucketBuilder<K>
BucketProxyProxyManager| Modifier and Type | Method and Description |
|---|---|
BucketProxy |
build(K key,
BucketConfiguration configuration)
Builds the
BucketProxy. |
BucketProxy |
build(K key,
Supplier<BucketConfiguration> configurationSupplier)
Has the same semantic with
build(Object, BucketConfiguration),
but additionally provides ability to provide configuration lazily, that can be helpful when figuring-out the right configuration parameters
is costly, for example because parameters for particular key are stored in external database,
configurationSupplier will be called if and only if bucket has not been persisted before. |
RemoteBucketBuilder<K> |
withImplicitConfigurationReplacement(long desiredConfigurationVersion,
TokensInheritanceStrategy tokensInheritanceStrategy)
Activates implicit configuration replacement.
|
RemoteBucketBuilder<K> |
withOptimization(Optimization optimization)
Configures the optimization strategy that will be applied for buckets that are built by this builder.
|
RemoteBucketBuilder<K> |
withRecoveryStrategy(RecoveryStrategy recoveryStrategy)
Configures custom recovery strategy instead of
RecoveryStrategy.RECONSTRUCT that is used by default. |
RemoteBucketBuilder<K> withRecoveryStrategy(RecoveryStrategy recoveryStrategy)
RecoveryStrategy.RECONSTRUCT that is used by default.recoveryStrategy - specifies the reaction which should be applied in case of previously saved state of bucket has been lost, explicitly removed or expired.thisRemoteBucketBuilder<K> withOptimization(Optimization optimization)
It is worth mentioning that optimization will take effect only if you reuse the bucket, so you need to store a reference to the bucket anywhere in order to reuse it later. In other words, if any request optimization strategy has been applied to the bucket proxy then proxy can not be treated as a cheap object.
* The full list of built-in optimizations can be found there Optimizations
optimization - optimization strategythisRemoteBucketBuilder<K> withImplicitConfigurationReplacement(long desiredConfigurationVersion, TokensInheritanceStrategy tokensInheritanceStrategy)
By default distributed bucket operates with configuration that was provided at the time of its first creation.
Providing the new configuration via RemoteBucketBuilder takes no effect if bucket is already persisted in the storage, because configuration is stored together with state of bucket.
Without implicit configuration replacement, there is only one way to replace configuration of bucket - is explicit calling of Bucket.replaceConfiguration(BucketConfiguration, TokensInheritanceStrategy).
When implicit configuration replacement is activated, bucket will check that version of configuration in the storage >= than provided desiredConfigurationVersion,
and automatically replace persisted configuration using provided tokensInheritanceStrategy in case of persisted configuration is obsolete.
desiredConfigurationVersion - specifies desired configuration versiontokensInheritanceStrategy - the strategy that will be used for token migration if desiredConfigurationVersion of persisted bucket is less that provided desiredConfigurationVersionthisBucketProxy build(K key, Supplier<BucketConfiguration> configurationSupplier)
build(Object, BucketConfiguration),
but additionally provides ability to provide configuration lazily, that can be helpful when figuring-out the right configuration parameters
is costly, for example because parameters for particular key are stored in external database,
configurationSupplier will be called if and only if bucket has not been persisted before.key - the key that used in external storage to distinguish one bucket from another.configurationSupplier - provider for bucket configurationBucketProxy created in lazy mode.BucketProxy build(K key, BucketConfiguration configuration)
BucketProxy. Proxy is being created in lazy mode, its state is not persisted in external storage until first interaction,
so if you want to save bucket state immediately then just call Bucket.getAvailableTokens().
If you had not used withOptimization(Optimization) during construction then created proxy can be treated as cheap object,
feel free just build, use and forget as many proxies under the same key as you need, do not cache the built instances.
key - the key that used in external storage to distinguish one bucket from another.configuration - limits configurationBucketProxy created in lazy mode.Copyright © 2022. All rights reserved.