你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn。
FabricServicePartitionResolver Class
- java.
lang. Object - ServicePartitionResolver
- microsoft.
servicefabric. services. client. FabricServicePartitionResolver
- microsoft.
public class FabricServicePartitionResolver implements ServicePartitionResolver
Implements the class that helps in determining the endpoint of a service. This class wraps the FabricClient's system.fabric.client.ServiceManagementClient#resolveServicePartitionAsync(java.net.URI) method, and implements a back-off/retry mechanism on errors from that method.
Field Summary
Modifier and Type | Field and Description |
---|---|
final Duration |
defaultMaxRetryBackoffInterval
This is the default max retry backoff interval used by ServicePartitionResolver's ResolveAsync method when it is invoked without explicitly specifying the maxRetryBackoffInterval argument. |
final Duration |
defaultResolveTimeout
This is the default resolve timeout per try used by the ResolveAsync method of ServicePartitionResolver when it is invoked without explicitly specifying the resolveTimeoutPerTry argument. |
Constructor Summary
Constructor | Description |
---|---|
FabricServicePartitionResolver(FabricClientSettings settings, String... connectionEndpoints) |
Instantiates a ServicePartitionResolver, uses the given FabricClient Settings and the connectionEndpoints to create a new instance of FabricClient. |
FabricServicePartitionResolver(String... connectionEndpoints) |
Instantiates a ServicePartitionResolver, uses the given connectionEndpoints to create a new instance of FabricClient. |
FabricServicePartitionResolver(Supplier<FabricClient> createFabricClient) |
Instantiates a ServicePartitionResolver, invoking the given delegate to instantiate FabricClient. |
FabricServicePartitionResolver(Supplier<FabricClient> createFabricClient, Supplier<FabricClient> recreateFabricClient) |
Instantiates a ServicePartionResolver, invoking the first delegate to instantiate FabricClient. During partition resolution if FabricClient object gets disposed and second delegate is provided, it uses the second delegate to re-create the FabricClient. The second delegate provides a way to specify an alternate way to create FabricClient if FabricClient created with first delegates get disposed. |
Method Summary
Modifier and Type | Method and Description |
---|---|
Service |
getDefault()
Gets the default ServicePartitionResolver |
Duration | getResolveTimeout() |
Duration | getRetryBackoffInterval() |
CompletableFuture<Resolved |
resolveAsync(ResolvedServicePartition previousRsp)
Resolves a partition of the specified service by invoking FabricClient's system.fabric.client.ServiceManagementClient#resolveServicePartitionAsync(URI) method with back-off/retry on retriable errors. This takes in the resolved service partition that was got via an earlier invocation of the ResolveAsync() method. This api-overload is used in cases where the client knows that the resolved service partition that it has is no longer valid. |
CompletableFuture<Resolved |
resolveAsync(ResolvedServicePartition previousRsp, Duration resolveTimeoutPerTry, Duration maxRetryBackoffInterval)
Resolves a partition of the specified service with backoff/ retry on retriable errors. This takes in the resolved service partition that was got via an earlier invocation of the ResolveAsync() method. This api-overload is used in cases where the client knows that the resolved service partition that it has is no longer valid. |
CompletableFuture<Resolved |
resolveAsync(URI serviceUri, ServicePartitionKey partitionKey)
Resolves a partition of the specified service by invoking FabricClient's system.fabric.client.ServiceManagementClient#resolveServicePartitionAsync(URI)method with back-off/retry on retriable errors. |
CompletableFuture<Resolved |
resolveAsync(URI serviceUri, ServicePartitionKey partitionKey, Duration resolveTimeoutPerTry, Duration maxRetryBackoffInterval)
Resolves a partition of the specified service by invoking system.fabric.client.ServiceManagementClient#resolveServicePartitionAsync(URI) method with back-off/retry on retriable errors. |
void |
setDefault(ServicePartitionResolver defaultServiceResolver)
Updates the default ServicePartitionResolver |
void | setResolveTimeout(Duration resolveTimeout) |
void | setRetryBackoffInterval(Duration retryBackoffInterval) |
Field Details
defaultMaxRetryBackoffInterval
public static final Duration defaultMaxRetryBackoffInterval= Duration.ofSeconds(5)
This is the default max retry backoff interval used by ServicePartitionResolver's ResolveAsync method when it is invoked without explicitly specifying the maxRetryBackoffInterval argument.
defaultResolveTimeout
public static final Duration defaultResolveTimeout= Duration.ofSeconds(30)
This is the default resolve timeout per try used by the ResolveAsync method of ServicePartitionResolver when it is invoked without explicitly specifying the resolveTimeoutPerTry argument.
Constructor Details
FabricServicePartitionResolver
public FabricServicePartitionResolver(FabricClientSettings settings, String... connectionEndpoints)
Instantiates a ServicePartitionResolver, uses the given FabricClient Settings and the connectionEndpoints to create a new instance of FabricClient.
Parameters:
FabricServicePartitionResolver
public FabricServicePartitionResolver(String... connectionEndpoints)
Instantiates a ServicePartitionResolver, uses the given connectionEndpoints to create a new instance of FabricClient.
Parameters:
FabricServicePartitionResolver
public FabricServicePartitionResolver(Supplier
Instantiates a ServicePartitionResolver, invoking the given delegate to instantiate FabricClient.
Parameters:
FabricServicePartitionResolver
public FabricServicePartitionResolver(Supplier
Instantiates a ServicePartionResolver, invoking the first delegate to instantiate FabricClient. During partition resolution if FabricClient object gets disposed and second delegate is provided, it uses the second delegate to re-create the FabricClient. The second delegate provides a way to specify an alternate way to create FabricClient if FabricClient created with first delegates get disposed.
Parameters:
Method Details
getDefault
public static ServicePartitionResolver getDefault()
Gets the default ServicePartitionResolver
Returns:
getResolveTimeout
public Duration getResolveTimeout()
getRetryBackoffInterval
public Duration getRetryBackoffInterval()
resolveAsync
public CompletableFuture
Resolves a partition of the specified service by invoking FabricClient's system.fabric.client.ServiceManagementClient#resolveServicePartitionAsync(URI) method with back-off/retry on retriable errors. This takes in the resolved service partition that was got via an earlier invocation of the ResolveAsync() method. This api-overload is used in cases where the client knows that the resolved service partition that it has is no longer valid.
Parameters:
Returns:
resolveAsync
public CompletableFuture
Resolves a partition of the specified service with backoff/ retry on retriable errors. This takes in the resolved service partition that was got via an earlier invocation of the ResolveAsync() method. This api-overload is used in cases where the client knows that the resolved service partition that it has is no longer valid.
Overrides:
FabricServicePartitionResolver.resolveAsync(ResolvedServicePartition previousRsp, Duration resolveTimeoutPerTry, Duration maxRetryBackoffInterval)Parameters:
Returns:
resolveAsync
public CompletableFuture
Resolves a partition of the specified service by invoking FabricClient's system.fabric.client.ServiceManagementClient#resolveServicePartitionAsync(URI)method with back-off/retry on retriable errors.
Parameters:
Returns:
resolveAsync
public CompletableFuture
Resolves a partition of the specified service by invoking system.fabric.client.ServiceManagementClient#resolveServicePartitionAsync(URI) method with back-off/retry on retriable errors.
Overrides:
FabricServicePartitionResolver.resolveAsync(URI serviceUri, ServicePartitionKey partitionKey, Duration resolveTimeoutPerTry, Duration maxRetryBackoffInterval)Parameters:
Returns:
setDefault
public static void setDefault(ServicePartitionResolver defaultServiceResolver)
Updates the default ServicePartitionResolver
Parameters:
setResolveTimeout
public void setResolveTimeout(Duration resolveTimeout)
Parameters:
setRetryBackoffInterval
public void setRetryBackoffInterval(Duration retryBackoffInterval)
Parameters: