private boolean isHistoryUpdateCompleted(final long guestId, final Connector connector) {
   if (connector.isAutonomous()) return isHistoryUpdateCompleted(guestId, connector.getName(), 0);
   final int[] connectorObjectTypeValues = connector.objectTypeValues();
   for (int connectorObjectTypeValue : connectorObjectTypeValues)
     if (!isHistoryUpdateCompleted(guestId, connector.getName(), connectorObjectTypeValue))
       return false;
   return true;
 }
  /**
   * Update all the facet types for a given user and connector.
   *
   * @param guestId the user for whom the connector is to be updated
   * @param connector the connector to be updated
   * @param force force an update (sync now); if false, it means it was called by the background
   *     "cron" task
   * @return
   */
  @Override
  public List<ScheduleResult> updateConnector(
      final long guestId, Connector connector, boolean force) {
    System.out.println("updateConnector");
    List<ScheduleResult> scheduleResults = new ArrayList<ScheduleResult>();
    StringBuilder messageRoot =
        new StringBuilder(
            "module=updateQueue component=connectorUpdateService" + " action=updateConnector");
    if (isShuttingDown) {
      logger.warn(messageRoot.append(" message=\"Service is shutting down... Refusing updates\""));
      return scheduleResults;
    }

    // if forcing an update (sync now), we actually want to flush the update requests
    // that have stacked up in the queue
    if (force) flushUpdateWorkerTasks(guestId, connector, false);

    // some connectors (e.g. the fitbit) need to decide what objectTypes to update by themselves;
    // for those, we pass 0 for the objectType parameter, which will be overridden by the
    // connector's updater
    final boolean historyUpdateCompleted = isHistoryUpdateCompleted(guestId, connector);
    if (connector.isAutonomous()) {
      scheduleObjectTypeUpdate(
          guestId,
          connector,
          0,
          scheduleResults,
          historyUpdateCompleted
              ? UpdateType.INCREMENTAL_UPDATE
              : UpdateType.INITIAL_HISTORY_UPDATE);
    } else {
      int[] objectTypeValues = connector.objectTypeValues();
      for (int objectTypes : objectTypeValues) {
        scheduleObjectTypeUpdate(
            guestId,
            connector,
            objectTypes,
            scheduleResults,
            historyUpdateCompleted
                ? UpdateType.INCREMENTAL_UPDATE
                : UpdateType.INITIAL_HISTORY_UPDATE);
      }
    }
    return scheduleResults;
  }