T
- R
- public class Wait<T,R> extends Object
Several operations, such as starting a cluster or submitting a job, are long-running
operations. After being initiated by a call to the API, these operations continue to run in the
background until they complete. A separate API call can be made to check the status of the
operation. Wait
objects encapsulate this process, polling for the status of the operation
until it completes.
Wait
objects expose both the response from the triggering API call and the awaited
resource. For example, the ClustersAPI.create(com.databricks.sdk.service.compute.CreateCluster)
method returns a Wait<ClusterDetails, CreateClusterResponse>
object. The response from
the API call to create the cluster is available via the getResponse()
method. The
awaited resource, the cluster details, is available via the get()
method.
The get()
method waits for the operation to complete for up to 20 minutes. To wait
for a custom duration, use the get(Duration)
method.
Constructor and Description |
---|
Wait(WaitStarter<T> impl) |
Wait(WaitStarter<T> impl,
R response) |
Modifier and Type | Method and Description |
---|---|
T |
get()
Wait for the operation to complete for up to 20 minutes.
|
T |
get(Duration timeout)
Wait for the operation to complete for up to the specified duration.
|
R |
getResponse()
Get the response for the initial API call made to start the operation.
|
Wait<T,R> |
onProgress(Consumer<T> progress) |
public Wait(WaitStarter<T> impl)
public Wait(WaitStarter<T> impl, R response)
public T get() throws TimeoutException
TimeoutException
- if the operation does not complete within 20 minutespublic T get(Duration timeout) throws TimeoutException
timeout
- the maximum duration to waitTimeoutException
- if the operation does not complete within the specified durationpublic R getResponse()
Copyright © 2024. All rights reserved.