public String setStatus(ParticipantStatus newState) { if (getListType().equals(newState)) return "participant is prepared for recovery"; 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"; } }
public String doSetStatus(String newState) { try { return setStatus(Enum.valueOf(ParticipantStatus.class, newState.toUpperCase())); } catch (IllegalArgumentException e) { StringBuilder sb = new StringBuilder("Valid status values are: "); for (ParticipantStatus lt : ParticipantStatus.values()) { sb.append(lt.name()).append(", "); } sb.append(" and only HEURISTIC and PREPARED will persist after JVM restart."); return sb.toString(); } }
public String getStatus() { return listType.toString(); }
public ActionBean(UidWrapper w) { super(w); boolean isJTS = JMXServer.isJTS() && w.getType().contains("ArjunaTransactionImple"); if (isJTS) { try { UidWrapper.setRecordWrapperTypeName(w.getType()); Class<ActionBeanWrapperInterface> cl = (Class<ActionBeanWrapperInterface>) Class.forName(w.getClassName()); Constructor<ActionBeanWrapperInterface> constructor = cl.getConstructor(ActionBean.class, UidWrapper.class); ra = constructor.newInstance(this, w); ra.activate(); } catch (Exception e) { // ClassNotFoundException, NoSuchMethodException, InvocationTargetException, IllegalAccessException, InstantiationException if (tsLogger.logger.isTraceEnabled()) tsLogger.logger.trace("Error constructing " + JMXServer.AJT_WRAPPER_TYPE + ": " + e); ra = createWrapper(w, true); } /* * For JTS we also store participant details under "CosTransactions/XAResourceRecord" * We may at some point want to augment the beans created in findParticipants below with * w.probe(JMXServer.AJT_RECORD_TYPE); */ } else { ra = createWrapper(w, true); // com.arjuna.ats.arjuna.coordinator.abstractrecord.RecordTypeManager.manager() } sminfo = new StateManagerWrapper(StoreManager.getRecoveryStore(), getUid(), getType()); for (ParticipantStatus lt : ParticipantStatus.values()) { findParticipants(recuids, ra.getRecords(lt), lt); } }
ParticipantStatus lt = logrec.getListType(); AbstractRecord targRecord = logrec.getRecord(); RecordList oldList = ra.getRecords(lt); RecordList newList = ra.getRecords(newStatus); if (lt.equals(ParticipantStatus.HEURISTIC)) { switch (newStatus) { case FAILED: ra.clearHeuristicDecision(TwoPhaseOutcome.FINISH_ERROR); break; case PENDING:
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; }
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"; } }
public ActionBean(UidWrapper w) { super(w); boolean isJTS = JMXServer.isJTS() && w.getType().endsWith("ArjunaTransactionImple"); // Participants in a JTS transaction are represented by entries in the ObjectStore List<UidWrapper> recuids = null; if (isJTS) { try { Class<ActionBeanWrapperInterface> cl = (Class<ActionBeanWrapperInterface>) Class.forName(JMXServer.AJT_WRAPPER_TYPE); Constructor<ActionBeanWrapperInterface> constructor = cl.getConstructor(ActionBean.class, UidWrapper.class); ra = constructor.newInstance(this, w); ra.activate(); } catch (Exception e) { // ClassNotFoundException, NoSuchMethodException, InvocationTargetException, IllegalAccessException, InstantiationException if (tsLogger.logger.isTraceEnabled()) tsLogger.logger.trace("Error constructing " + JMXServer.AJT_WRAPPER_TYPE + ": " + e); ra = createWrapper(w, true); } /* * for JTS actions the participants will have entries in the ObjectStore. * these entries will be associated with the current MBean (refer to * the method findParticipants below for details) */ recuids = w.probe(JMXServer.AJT_RECORD_TYPE, JMXServer.AJT_XAREC_TYPE); } else { ra = createWrapper(w, true); // com.arjuna.ats.arjuna.coordinator.abstractrecord.RecordTypeManager.manager() } sminfo = new StateManagerWrapper(StoreManager.getRecoveryStore(), getUid(), getType()); for (ParticipantStatus lt : ParticipantStatus.values()) { findParticipants(recuids, ra.getRecords(lt), lt); } }
public String getStatus() { if (isHeuristic()) { String type = getHeuristicStatus(); if (!type.equals(HeuristicStatus.UNKNOWN.name())) return type; } return listType.toString(); }
public boolean isHeuristic() { return listType.equals(ParticipantStatus.HEURISTIC); } }
public ActionBean(UidWrapper w) { super(w); boolean isJTS = JMXServer.isJTS() && w.getType().contains("ArjunaTransactionImple"); if (isJTS) { try { UidWrapper.setRecordWrapperTypeName(w.getType()); Class<ActionBeanWrapperInterface> cl = (Class<ActionBeanWrapperInterface>) Class.forName(w.getClassName()); Constructor<ActionBeanWrapperInterface> constructor = cl.getConstructor(ActionBean.class, UidWrapper.class); ra = constructor.newInstance(this, w); ra.activate(); } catch (Exception e) { // ClassNotFoundException, NoSuchMethodException, InvocationTargetException, IllegalAccessException, InstantiationException if (tsLogger.logger.isTraceEnabled()) tsLogger.logger.trace("Error constructing " + JMXServer.AJT_WRAPPER_TYPE + ": " + e); ra = createWrapper(w, true); } /* * For JTS we also store participant details under "CosTransactions/XAResourceRecord" * We may at some point want to augment the beans created in findParticipants below with * w.probe(JMXServer.AJT_RECORD_TYPE); */ } else { ra = createWrapper(w, true); // com.arjuna.ats.arjuna.coordinator.abstractrecord.RecordTypeManager.manager() } sminfo = new StateManagerWrapper(StoreManager.getRecoveryStore(), getUid(), getType()); for (ParticipantStatus lt : ParticipantStatus.values()) { findParticipants(recuids, ra.getRecords(lt), lt); } }
ParticipantStatus lt = logrec.getListType(); AbstractRecord targRecord = logrec.getRecord(); RecordList oldList = ra.getRecords(lt); RecordList newList = ra.getRecords(newStatus); if (lt.equals(ParticipantStatus.HEURISTIC)) { switch (newStatus) { case FAILED: ra.clearHeuristicDecision(TwoPhaseOutcome.FINISH_ERROR); break; case PENDING:
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; }
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"; } }
public String getStatus() { if (isHeuristic()) { String type = getHeuristicStatus(); if (!type.equals(HeuristicStatus.UNKNOWN.name())) return type; } return listType.toString(); }
public boolean isHeuristic() { return listType.equals(ParticipantStatus.HEURISTIC); }
public ActionBean(UidWrapper w) { super(w); boolean isJTS = JMXServer.isJTS() && w.getType().contains("ArjunaTransactionImple"); if (isJTS) { try { UidWrapper.setRecordWrapperTypeName(w.getType()); Class<ActionBeanWrapperInterface> cl = (Class<ActionBeanWrapperInterface>) Class.forName(w.getClassName()); Constructor<ActionBeanWrapperInterface> constructor = cl.getConstructor(ActionBean.class, UidWrapper.class); ra = constructor.newInstance(this, w); ra.activate(); } catch (Exception e) { // ClassNotFoundException, NoSuchMethodException, InvocationTargetException, IllegalAccessException, InstantiationException if (tsLogger.logger.isTraceEnabled()) tsLogger.logger.trace("Error constructing " + JMXServer.AJT_WRAPPER_TYPE + ": " + e); ra = createWrapper(w, true); } /* * For JTS we also store participant details under "CosTransactions/XAResourceRecord" * We may at some point want to augment the beans created in findParticipants below with * w.probe(JMXServer.AJT_RECORD_TYPE); */ } else { ra = createWrapper(w, true); // com.arjuna.ats.arjuna.coordinator.abstractrecord.RecordTypeManager.manager() } sminfo = new StateManagerWrapper(StoreManager.getRecoveryStore(), getUid(), getType()); for (ParticipantStatus lt : ParticipantStatus.values()) { findParticipants(recuids, ra.getRecords(lt), lt); } }
ParticipantStatus lt = logrec.getListType(); AbstractRecord targRecord = logrec.getRecord(); RecordList oldList = ra.getRecords(lt); RecordList newList = ra.getRecords(newStatus); if (lt.equals(ParticipantStatus.HEURISTIC)) { switch (newStatus) { case FAILED: ra.clearHeuristicDecision(TwoPhaseOutcome.FINISH_ERROR); break; case PENDING:
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; }
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"; } }