@Override
  public void prepare(Object o) {

    executor = MoreExecutors.listeningDecorator(newFixedThreadPoolWithQueueSize(5, 20));

    Preconditions.checkNotNull(providerQueue);
    Preconditions.checkNotNull(this.klass);
    Preconditions.checkNotNull(configuration.getOauth().getAppId());
    Preconditions.checkNotNull(configuration.getOauth().getAppSecret());
    Preconditions.checkNotNull(configuration.getOauth().getUserAccessToken());

    client = getFacebookClient();

    if (configuration.getInfo() != null && configuration.getInfo().size() > 0) {

      List<String> ids = new ArrayList<String>();
      List<String[]> idsBatches = new ArrayList<String[]>();

      for (String s : configuration.getInfo()) {
        if (s != null) {
          ids.add(s);

          if (ids.size() >= 100) {
            // add the batch
            idsBatches.add(ids.toArray(new String[ids.size()]));
            // reset the Ids
            ids = new ArrayList<String>();
          }
        }
      }
    }
  }
  protected Facebook getFacebookClient() {
    ConfigurationBuilder cb = new ConfigurationBuilder();
    cb.setDebugEnabled(true)
        .setOAuthAppId(configuration.getOauth().getAppId())
        .setOAuthAppSecret(configuration.getOauth().getAppSecret())
        .setOAuthAccessToken(configuration.getOauth().getUserAccessToken())
        .setOAuthPermissions(ALL_PERMISSIONS)
        .setJSONStoreEnabled(true);

    FacebookFactory ff = new FacebookFactory(cb.build());
    Facebook facebook = ff.getInstance();

    return facebook;
  }
  @Override
  public void startStream() {

    client = getFacebookClient();

    if (configuration.getInfo() != null && configuration.getInfo().size() > 0) {
      for (String id : configuration.getInfo()) {
        executor.submit(new FacebookFeedPollingTask(this, id));
      }
      running.set(true);
    } else {
      try {
        String id = client.getMe().getId();
        executor.submit(new FacebookFeedPollingTask(this, id));
        running.set(true);
      } catch (FacebookException e) {
        LOGGER.error(e.getMessage());
        running.set(false);
      }
    }
  }