/** * return the Uid for given AbstractRecord * @param rec the record whose Uid is required * @return the Uid of the requested record */ public Uid getUid(AbstractRecord rec) { return ra.getUid(rec); }
/** * remove the a participant * @param logRecordWrapper the wrapped log record */ public void remove(LogRecordWrapper logRecordWrapper) { ra.remove(logRecordWrapper); }
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); } }
for (AbstractRecord rec = list.peekFront(); rec != null; rec = list.peekNext(rec)) { LogRecordWrapper lw; int i = recuids == null ? -1 : recuids.indexOf(new UidWrapper(ra.getUid(rec))); OSEntryBean p = recuids.get(i).getMBean(); lw.init(this, rec, listType); } else { if (tsLogger.logger.isTraceEnabled()) tsLogger.logger.trace("participant record is not a LogRecordWrapper"); lw = createParticipant(rec, listType, recuids.get(i)); lw = createParticipant(rec, listType); lw.activate(); participants.add(lw);
ParticipantStatus lt = logrec.getListType(); AbstractRecord targRecord = logrec.getRecord(); RecordList oldList = ra.getRecords(lt); RecordList newList = ra.getRecords(newStatus); if (oldList.remove(targRecord)) { if (newList.insert(targRecord)) { if (lt.equals(ParticipantStatus.HEURISTIC)) { switch (newStatus) { case FAILED: ra.clearHeuristicDecision(TwoPhaseOutcome.FINISH_ERROR); break; case PENDING: ra.clearHeuristicDecision(TwoPhaseOutcome.NOT_PREPARED); break; case PREPARED: ra.clearHeuristicDecision(TwoPhaseOutcome.PREPARE_OK); break; case READONLY: ra.clearHeuristicDecision(TwoPhaseOutcome.PREPARE_READONLY); break; default: ra.doUpdateState();
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 StringBuilder toString(String prefix, StringBuilder sb) { ra.toString(prefix, sb); prefix += '\t'; sb.append('\n').append(prefix).append(sminfo.getCreationTime()); sb.append('\n').append(prefix).append(sminfo.getAgeInSeconds()); for (LogRecordWrapper p : participants) { p.toString(prefix, sb); } return sb; }
public String getXid() { try { SubordinateAtomicAction sub = (SubordinateAtomicAction) ra.getAction(); return sub.getXid().toString(); } catch (ClassCastException e) { if (tsLogger.logger.isDebugEnabled()) { BasicAction ba = ra.getAction(); tsLogger.logger.debug("unable to cast " + ba.toString() + e.getMessage()); } return e.getMessage(); } }
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); } }
for (AbstractRecord rec = list.peekFront(); rec != null; rec = list.peekNext(rec)) { LogRecordWrapper lw; int i = recuids == null ? -1 : recuids.indexOf(new UidWrapper(ra.getUid(rec))); OSEntryBean p = recuids.get(i).getMBean(); lw.init(this, rec, listType); } else { if (tsLogger.logger.isTraceEnabled()) tsLogger.logger.trace("participant record is not a LogRecordWrapper"); lw = createParticipant(rec, listType, recuids.get(i)); lw = createParticipant(rec, listType); lw.activate(); participants.add(lw);
ParticipantStatus lt = logrec.getListType(); AbstractRecord targRecord = logrec.getRecord(); RecordList oldList = ra.getRecords(lt); RecordList newList = ra.getRecords(newStatus); if (oldList.remove(targRecord)) { if (newList.insert(targRecord)) { if (lt.equals(ParticipantStatus.HEURISTIC)) { switch (newStatus) { case FAILED: ra.clearHeuristicDecision(TwoPhaseOutcome.FINISH_ERROR); break; case PENDING: ra.clearHeuristicDecision(TwoPhaseOutcome.NOT_PREPARED); break; case PREPARED: ra.clearHeuristicDecision(TwoPhaseOutcome.PREPARE_OK); break; case READONLY: ra.clearHeuristicDecision(TwoPhaseOutcome.PREPARE_READONLY); break; default: ra.doUpdateState();
public StringBuilder toString(String prefix, StringBuilder sb) { ra.toString(prefix, sb); prefix += '\t'; sb.append('\n').append(prefix).append(sminfo.getCreationTime()); sb.append('\n').append(prefix).append(sminfo.getAgeInSeconds()); for (LogRecordWrapper p : participants) { p.toString(prefix, sb); } return sb; }
public String getParentNodeName() { try { SubordinateAtomicAction sub = (SubordinateAtomicAction) ra.getAction(); return sub.getParentNodeName(); } catch (ClassCastException e) { if (tsLogger.logger.isDebugEnabled()) { BasicAction ba = ra.getAction(); tsLogger.logger.debug("unable to cast " + (ba == null ? "null" : ba.toString()) + ": " + e.getMessage()); } return e.getMessage(); } } }
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); } }
for (AbstractRecord rec = list.peekFront(); rec != null; rec = list.peekNext(rec)) { LogRecordWrapper lw; int i = recuids == null ? -1 : recuids.indexOf(new UidWrapper(ra.getUid(rec))); OSEntryBean p = recuids.get(i).getMBean(); lw.init(this, rec, listType); } else { if (tsLogger.logger.isTraceEnabled()) tsLogger.logger.trace("participant record is not a LogRecordWrapper"); lw = createParticipant(rec, listType, recuids.get(i)); lw = createParticipant(rec, listType); lw.activate(); participants.add(lw);
ParticipantStatus lt = logrec.getListType(); AbstractRecord targRecord = logrec.getRecord(); RecordList oldList = ra.getRecords(lt); RecordList newList = ra.getRecords(newStatus); if (oldList.remove(targRecord)) { if (newList.insert(targRecord)) { if (lt.equals(ParticipantStatus.HEURISTIC)) { switch (newStatus) { case FAILED: ra.clearHeuristicDecision(TwoPhaseOutcome.FINISH_ERROR); break; case PENDING: ra.clearHeuristicDecision(TwoPhaseOutcome.NOT_PREPARED); break; case PREPARED: ra.clearHeuristicDecision(TwoPhaseOutcome.PREPARE_OK); break; case READONLY: ra.clearHeuristicDecision(TwoPhaseOutcome.PREPARE_READONLY); break; default: ra.doUpdateState();
public StringBuilder toString(String prefix, StringBuilder sb) { ra.toString(prefix, sb); prefix += '\t'; sb.append('\n').append(prefix).append(sminfo.getCreationTime()); sb.append('\n').append(prefix).append(sminfo.getAgeInSeconds()); for (LogRecordWrapper p : participants) { p.toString(prefix, sb); } return sb; }
/** * return the Uid for given AbstractRecord * @param rec the record whose Uid is required * @return the Uid of the requested record */ public Uid getUid(AbstractRecord rec) { return ra.getUid(rec); }
/** * remove the a participant * @param logRecordWrapper the wrapped log record */ public void remove(LogRecordWrapper logRecordWrapper) { ra.remove(logRecordWrapper); }
public String getParentNodeName() { try { SubordinateAtomicAction sub = (SubordinateAtomicAction) ra.getAction(); return sub.getParentNodeName(); } catch (ClassCastException e) { if (tsLogger.logger.isDebugEnabled()) { BasicAction ba = ra.getAction(); tsLogger.logger.debug("unable to cast " + (ba == null ? "null" : ba.toString()) + ": " + e.getMessage()); } return e.getMessage(); } } }