Skip to content

Adding listener when getting bucket through Supplier #184

Discussion options

You must be logged in to vote

@haiderali22 Hello,

// acquire cheap proxy to bucket  
Bucket tokenBucket = buckets.getProxy(apiKey, configurationLazySupplier);

The code above returns the bucket without listeners independently whether or not bucket had been created previously and listener were attached, because listeners are never stored in the GRID. Bucket persists only configuration and currently available tokens, so you can safely modify code like bellow, there is no chance that it will be multiple listeners on the same bucket

// acquire cheap proxy to bucket  
	Bucket tokenBucket = buckets.getProxy(apiKey, configurationLazySupplier).toListenable(myListener);

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by haiderali22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants