Esempio n. 1
0
  private int preSnipe() {
    UpdateBlocker.startBlocking();
    mEntry.setLastStatus("Preparing snipe.");
    //  Log in
    mCJ = mLogin.getSignInCookie(null);
    if (mCJ == null) {
      //  Alert somebody that we couldn't log in?
      mEntry.setLastStatus(
          "Pre-snipe login failed.  Snipe will be retried, but is unlikely to fire.");
      MQFactory.getConcrete("Swing").enqueue("NOTIFY Pre-snipe login failed.");
      JConfig.log().logDebug("Pre-snipe login failed.");
      UpdateBlocker.endBlocking();
      return RESNIPE;
    }

    int presnipeResult = SUCCESSFUL;

    //  Get Bid Key/Form
    try {
      JConfig.increment("stats.presniped");
      mBidForm = mBidder.getBidForm(mCJ, mEntry, mEntry.getSnipeAmount());
    } catch (BadBidException bbe) {
      String result = getSnipeResult(bbe.getResult(), mEntry.getTitle(), mEntry);
      mEntry.setLastStatus(result);
      MQFactory.getConcrete("Swing").enqueue("NOTIFY " + result);
      JConfig.log().logDebug(result);
      presnipeResult = FAIL;
    }
    UpdateBlocker.endBlocking();

    return presnipeResult;
  }
Esempio n. 2
0
  private int doSnipe() {
    //  Just punt if we had failed to get the bidding form initially.
    if (mBidForm == null) return FAIL;
    UpdateBlocker.startBlocking();
    if (mEntry.isMultiSniped()) {
      MultiSnipe ms = mEntry.getMultiSnipe();
      //  Make sure there aren't any update-unfinished items.
      if (ms.anyEarlier(mEntry)) {
        mEntry.setLastStatus(
            "An earlier snipe in this multisnipe group has not ended, or has not been updated after ending.");
        mEntry.setLastStatus(
            "This snipe is NOT being fired, as it could end up winning two items.");
        UpdateBlocker.endBlocking();
        return RESNIPE;
      }
    }
    MQFactory.getConcrete("Swing").enqueue("Sniping on " + mEntry.getTitle());
    mEntry.setLastStatus("Firing actual snipe.");

    int rval =
        mBidder.placeFinalBid(
            mCJ, mBidForm, mEntry, mEntry.getSnipeAmount(), mEntry.getSnipeQuantity());
    JConfig.increment("stats.sniped");
    String snipeResult = getSnipeResult(rval, mEntry.getTitle(), mEntry);
    mEntry.setLastStatus(snipeResult);

    MQFactory.getConcrete("Swing").enqueue("NOTIFY " + snipeResult);
    JConfig.log().logDebug(snipeResult);

    mEntry.snipeCompleted();
    UpdateBlocker.endBlocking();
    return DONE;
  }