@Override
  public java.util.concurrent.Future<UpdateThingShadowResult> updateThingShadowAsync(
      final UpdateThingShadowRequest request,
      final com.amazonaws.handlers.AsyncHandler<UpdateThingShadowRequest, UpdateThingShadowResult>
          asyncHandler) {

    return executorService.submit(
        new java.util.concurrent.Callable<UpdateThingShadowResult>() {
          @Override
          public UpdateThingShadowResult call() throws Exception {
            UpdateThingShadowResult result;

            try {
              result = updateThingShadow(request);
            } catch (Exception ex) {
              if (asyncHandler != null) {
                asyncHandler.onError(ex);
              }
              throw ex;
            }

            if (asyncHandler != null) {
              asyncHandler.onSuccess(request, result);
            }
            return result;
          }
        });
  }
  @Override
  public java.util.concurrent.Future<Void> publishAsync(
      final PublishRequest request,
      final com.amazonaws.handlers.AsyncHandler<PublishRequest, Void> asyncHandler) {

    return executorService.submit(
        new java.util.concurrent.Callable<Void>() {
          @Override
          public Void call() throws Exception {
            Void result;

            try {
              publish(request);
              result = null;
            } catch (Exception ex) {
              if (asyncHandler != null) {
                asyncHandler.onError(ex);
              }
              throw ex;
            }

            if (asyncHandler != null) {
              asyncHandler.onSuccess(request, result);
            }
            return result;
          }
        });
  }