Example #1
0
  public StringBuilder toString(String prefix, StringBuilder sb) {
    prefix += "\t";
    if (parent != null && rec != null) {
      sb.append('\n').append(prefix).append(parent.getUid(rec));
      sb.append('\n').append(prefix).append(listType.toString());
      sb.append('\n').append(prefix).append(rec.type());
      sb.append('\n').append(prefix).append(parent.getCreationTime());
      sb.append('\n').append(prefix).append(parent.getAgeInSeconds());
    } else {
      sb.append('\n').append(prefix).append(_uidWrapper.getName());
    }

    return sb;
  }
Example #2
0
  public String setStatus(ParticipantStatus newState) {
    if (getListType().equals(newState)) return "participant is prepared for recovery";

    /*
     * Only move a heuristic to the prepared list if it hasn't already committed or rolled back
     */
    if (newState.equals(ParticipantStatus.PREPARED)
        && getListType().equals(ParticipantStatus.HEURISTIC)) {
      HeuristicStatus heuristicStatus = HeuristicStatus.valueOf(getHeuristicStatus());

      if (heuristicStatus.equals(HeuristicStatus.HEURISTIC_COMMIT)
          || heuristicStatus.equals(HeuristicStatus.HEURISTIC_ROLLBACK)) {
        return "participant has already committed or rolled back";
      }
    }

    if (parent != null && parent.setStatus(this, newState)) {
      listType = newState;

      if (newState == ParticipantStatus.PREPARED)
        return "participant recovery will be attempted during the next recovery pass";

      return "participant status change was successful";
    } else {
      return "participant status change failed";
    }
  }
Example #3
0
  public String remove(boolean reprobe) throws MBeanException {
    if (parent != null) {
      parent.remove(this);
      _uidWrapper.unregister();
      if (reprobe) _uidWrapper.probe();
    }

    return "Record successfully removed";
  }
Example #4
0
  private static UidWrapper makeWrapper(ActionBean parent, AbstractRecord rec, String beanType) {
    UidWrapper w =
        new UidWrapper(
            parent._uidWrapper.getBrowser(),
            beanType,
            rec.type(),
            rec.getClass().getName(),
            rec.order(),
            false);
    // TODO look up the hander for rec.type() and use that to create the wrapper
    w.setName(parent.getName() + ",puid=" + rec.order().fileStringForm());

    return w;
  }
Example #5
0
 public void init(ActionBean parent, AbstractRecord rec, ParticipantStatus listType) {
   this.parent = parent;
   this.rec = rec;
   this.listType = listType;
   _uidWrapper.setName(parent.getName() + ",puid=" + rec.order().fileStringForm());
 }