public void get()

in aws-iot-device-sdk-java/src/main/java/com/amazonaws/services/iot/client/core/AwsIotCompletion.java [171:219]


    public void get(AbstractAwsIotClient client) throws AWSIotException, AWSIotTimeoutException {
        synchronized (this) {
            if (hasSuccess || hasFailure || hasTimeout) {
                // operation has completed before get() is called
                if (!isAsync) {
                    if (hasFailure) {
                        throw new AWSIotException("Error happened when processing command " + topic);
                    }
                    if (hasTimeout) {
                        throw new AWSIotTimeoutException("Request timed out when processing command " + topic);
                    }
                }
                return;
            }

            if (timeout > 0) {
                timeoutTask = client.scheduleTimeoutTask(new Runnable() {
                    @Override
                    public void run() {
                        onTimeout();
                    }
                }, timeout);
            }

            // if it's an asynchronous request, we don't block the calling
            // thread
            if (isAsync) {
                return;
            }

            while (!hasSuccess && !hasFailure && !hasTimeout) {
                try {
                    wait();
                } catch (InterruptedException e) {
                    cancelTimeoutTask();
                    throw new AWSIotException(e);
                }
            }

            cancelTimeoutTask();

            if (hasFailure) {
                throw new AWSIotException(errorCode, errorMessage);
            }
            if (hasTimeout) {
                throw new AWSIotTimeoutException("Request timed out when processing request " + topic);
            }
        }
    }