Class AwsIotCompletion

java.lang.Object
com.amazonaws.services.iot.client.AWSIotMessage
com.amazonaws.services.iot.client.core.AwsIotCompletion
All Implemented Interfaces:
AwsIotMessageCallback
Direct Known Subclasses:
AwsIotDeviceCommand

public class AwsIotCompletion extends AWSIotMessage
This is a helper class that can be used to manage the request execution and return either synchronously or asynchronously the result, e.g. success, failure, or timeout. It's used by most of the APIs to implement blocking and non-blocking calls with timeout support.
  • Field Details

    • request

      protected final AWSIotMessage request
      The request containing the callback functions.
    • timeout

      protected final long timeout
      The timeout associated with the request.
    • isAsync

      protected final boolean isAsync
      whether the request is asynchronous or not.
    • timeoutTask

      protected Future<?> timeoutTask
      The future object of the timeout task.
    • hasSuccess

      protected boolean hasSuccess
      Indicates whether the request has completed successfully.
    • hasFailure

      protected boolean hasFailure
      Indicates whether the request has completed with failure.
    • hasTimeout

      protected boolean hasTimeout
      Indicates whether the request has timed out.
  • Constructor Details

    • AwsIotCompletion

      public AwsIotCompletion(String topic, AWSIotQos qos, long timeout)
      Instantiates a new completion object with a synchronous request.
      Parameters:
      topic - the topic of the request
      qos - the QoS of the request
      timeout - the timeout in milliseconds for the request. If timeout is 0 or less, the request will never be timed out.
    • AwsIotCompletion

      public AwsIotCompletion(String topic, AWSIotQos qos, String payload, long timeout)
      Instantiates a new completion object with a synchronous request.
      Parameters:
      topic - the topic of the request
      qos - the QoS of the request
      payload - the string payload of the request
      timeout - the timeout in milliseconds for the request. If timeout is 0 or less, the request will never be timed out.
    • AwsIotCompletion

      public AwsIotCompletion(String topic, AWSIotQos qos, byte[] payload, long timeout)
      Instantiates a new completion object with a synchronous request.
      Parameters:
      topic - the topic of the request
      qos - the QoS of the request
      payload - the byte array payload of the request
      timeout - the timeout in milliseconds for the request. If timeout is 0 or less, the request will never be timed out.
    • AwsIotCompletion

      public AwsIotCompletion(long timeout, boolean isAsync)
      Instantiates a new completion object either synchronous or asynchronous request based on the isAsync argument.
      Parameters:
      timeout - the timeout in milliseconds for the request. If timeout is 0 or less, the request will never be timed out.
      isAsync - whether or not the request is asynchronous
    • AwsIotCompletion

      public AwsIotCompletion(AWSIotMessage req, long timeout, boolean isAsync)
      Instantiates a new completion object either synchronous or asynchronous request based on the isAsync argument. Callback functions are provided through the req argument.
      Parameters:
      req - the request containing request topic, QoS, payload, and callback functions for asynchronous requests.
      timeout - the timeout in milliseconds for the request. If timeout is 0 or less, the request will never be timed out.
      isAsync - whether or not the request is asynchronous
  • Method Details