@Override
 public JcUser deleteWeibo(JcUser jcUser) {
   this.jcUser = jcUser;
   UserTask userTask = userTaskPersistenceService.getUserTaskByKey(jcUser.getAccessToken());
   if (userTask == null || !userTask.getTask().isAlive()) {
     if (userTask == null) userTask = new UserTask();
     else userTaskPersistenceService.delete(userTask);
     tm.client.setToken(jcUser.getAccessToken());
     List<Status> statuses = weiboPersistenceService.getAllTop(jcUser);
     if (statuses.size() == 0) {
       jcUser.setDeleteCount(-1);
       return jcUser;
     }
     DeleteTask deleteTask = new DeleteTask(jcUser.getAccessToken());
     deleteTask.setStatues(statuses);
     deleteTask.start();
     // jcUser.setDeleteTask(deleteTask);
     userTask.setKey(jcUser.getAccessToken());
     userTask.setTask(deleteTask);
     userTaskPersistenceService.save(userTask);
   }
   jcUser.setDeleteCount(destroyedIndex + 1);
   jcUser.setOutOfLimit(outOfLimit);
   return this.jcUser;
 }
  /** call Weibo api to obtain weibos return count weibos have been saved */
  @Override
  public JcUser obtainWeibo(JcUser jcUser, ServletContext context) {
    int count = 0;
    int swoopCount = 0;
    int totalNumber = 0;
    int totalPage = 0;
    StatusWapper statusWapper = null;

    // get user's AccessToken by sessionId.
    // this.jcUser =
    // jcUserPersistenceService.getUserBySessionId(jcUser.getSession()); it
    // should be handled by security validation
    if (jcUser.getAccessToken() == null || jcUser.getAccessToken().length() == 0) return jcUser;
    this.jcUser = jcUser;
    preparePath(context);

    tm.client.setToken(jcUser.getAccessToken());
    c.client.setToken(jcUser.getAccessToken());

    // begin to obtain weibo from weibo api.
    statusWapper = obtainWeibo(tm, jcUser, 1);
    count += weiboPersistenceService.saveStatuses(statusWapper.getStatuses());
    swoopCount += statusWapper.getStatuses().size();

    totalNumber = (int) (statusWapper.getTotalNumber()); // total weibos the
    // user have
    totalPage = totalNumber % 100 == 0 ? totalNumber / 100 : totalNumber / 100 + 1;
    // because weibo api has a limit that only 100 weibos can be obtained
    // each request.
    for (int page = 2; page < totalPage; page++) {
      statusWapper = obtainWeibo(tm, jcUser, page);
      // if (callCount >= limit || outOfLimit == true)
      if (jcUser.isOutOfLimit()) break;
      count += weiboPersistenceService.saveStatuses(statusWapper.getStatuses());
      swoopCount += statusWapper.getStatuses().size();
    }
    LOG.debug("obtained " + swoopCount + " Weibos");
    LOG.debug("save " + count + " Weibos");
    this.jcUser.setWeiboCount(count);
    this.jcUser.setThumbnailCount(thumbnailCount);
    this.jcUser.setLargeCount(largeCount);
    this.jcUser.setCommentCount(commentCount);
    return this.jcUser;
  }