public Response validateCredentials() {
    Response ableToGetToken = Response.SUCCESSFUL;

    if (AmazonSharedPreferencesWrapper.areCredentialsExpired(this.sharedPreferences)) {
      Log.i(LOG_TAG, "Credentials were expired.");

      clearCredentials();

      AmazonTVMClient tvm =
          new AmazonTVMClient(
              this.sharedPreferences,
              PropertyLoader.getInstance().getTokenVendingMachineURL(),
              PropertyLoader.getInstance().useSSL());
      ableToGetToken = tvm.anonymousRegister();
      if (ableToGetToken.requestWasSuccessful()) {
        ableToGetToken = tvm.getToken();
      }
    }

    if (ableToGetToken.requestWasSuccessful() && ddb == null) {
      Log.i(LOG_TAG, "Creating New Credentials.");

      AWSCredentials credentials =
          AmazonSharedPreferencesWrapper.getCredentialsFromSharedPreferences(
              this.sharedPreferences);

      ddb = new AmazonDynamoDBClient(credentials);
    }

    return ableToGetToken;
  }
  public Response validateCredentials() {

    Response ableToGetToken = Response.SUCCESSFUL;

    if (AmazonSharedPreferencesWrapper.areCredentialsExpired(this.sharedPreferences)) {

      synchronized (this) {
        if (AmazonSharedPreferencesWrapper.areCredentialsExpired(this.sharedPreferences)) {

          Log.i(LOG_TAG, "Credentials were expired.");

          AmazonTVMClient tvm =
              new AmazonTVMClient(
                  this.sharedPreferences,
                  PropertyLoader.getInstance().getTokenVendingMachineURL(),
                  PropertyLoader.getInstance().useSSL());

          ableToGetToken = tvm.anonymousRegister();

          if (ableToGetToken.requestWasSuccessful()) {

            ableToGetToken = tvm.getToken();

            if (ableToGetToken.requestWasSuccessful()) {
              Log.i(LOG_TAG, "Creating New Credentials.");
              initClients();
            }
          }
        }
      }

    } else if (ddb == null) {

      synchronized (this) {
        if (ddb == null) {

          Log.i(LOG_TAG, "Creating New Credentials.");
          initClients();
        }
      }
    }

    return ableToGetToken;
  }