Azure / azure-sdk-for-java

This repository is for active development of the Azure SDK for Java. For consumers of the SDK we recommend visiting our public developer docs at https://docs.microsoft.com/java/azure/ or our versioned developer docs at https://azure.github.io/azure-sdk-for-java.

Repository from Github https://github.comAzure/azure-sdk-for-javaRepository from Github https://github.comAzure/azure-sdk-for-java

Clientcore poller design considerations

srnagar opened this issue · comments

Reference PR - #44670

Comments from @alzimmermsft

  1. Race conditions in chained polling strategy

Can ChainedPollingStrategy be re-used in multiple locations? If it can, we may need to harden this method to prevent race conditions from happening.

  1. Revisit polling strategy constructors and order of evaluation of polling strategies

Do we have any concerns with the design of this type? Such as the opinions on which strategy are included here and with which order they are?

  1. Customizable headers for OperationResourcePollingStrategy

Why don't we provide a way to set the HTTP header inspected by OperationResourcePollingStrategy in any of these constructor methods?

  1. PollingContext redesign

Now that we're given a chance to make breaking changes, is there anything we'd want to change about PollingContext? Possibly elevating some key-value pairs in this Map to typed properties on this class?

  1. Do we need the Poller interface?

Do we need to have an interface and class for implementing polling? Could we instead just use SimplePoller directly in public API?

  1. Expandable enum caching

If we're not going to cache instance created here we don't really need to use a backing Map to store constants defined by the ExpandableEnum. Rather we could do simple string equivalence checking that'd should be more performant as map usage will require scanning name at least once for its hash to determine the map bucket and zero to a few times to compare it against keys found in the bucket. This logic would be a basic initial check on name.length() matching known lengths, if not matched we know this is new, and then casing on length matches to do direct value comparisons.