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; }
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; }
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 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); } }
/** * Remove this AtomicAction from the ObjectStore * @return a textual indication of whether the remove operation succeeded */ public String remove() { // first unregister each participant of this action Iterator<LogRecordWrapper> i = participants.iterator(); while (i.hasNext()) { LogRecordWrapper w = i.next(); w.remove(false); i.remove(); } try { if (!StoreManager.getRecoveryStore().remove_committed(getUid(), getType())) return "Attempt to remove transaction failed"; _uidWrapper.unregister(); return "Transaction successfully removed"; } catch (ObjectStoreException e) { return "Unable to remove transaction: " + e.getMessage(); } finally { _uidWrapper.probe(); } }
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);
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 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()); }
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 remove(boolean reprobe) throws MBeanException { if (parent != null) { parent.remove(this); _uidWrapper.unregister(); if (reprobe) _uidWrapper.probe(); } return "Record successfully removed"; }
/** * Remove this AtomicAction from the ObjectStore * @return a textual indication of whether the remove operation succeeded */ public String remove() { try { if (!StoreManager.getRecoveryStore().remove_committed(getUid(), getType())) return "Attempt to remove transaction failed"; else w.probe(); return "Transaction successfully removed"; } catch (ObjectStoreException e) { return "Unable to remove transaction: " + e.getMessage(); } }
public void init(ActionBean parent, AbstractRecord rec, ParticipantStatus listType) { this.parent = parent; this.rec = rec; this.listType = listType; objName = parent.getName() + ",puid=" + rec.order().fileStringForm(); }
@Override protected LogRecordWrapper createParticipant(AbstractRecord rec, ParticipantStatus listType) { if (rec instanceof com.arjuna.ats.internal.jta.resources.arjunacore.XAResourceRecord) return new com.arjuna.ats.internal.jta.tools.osb.mbean.jta.XAResourceRecordBean(this, rec, listType); else return super.createParticipant(rec, listType); } /*
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); } }
/** * Remove this AtomicAction from the ObjectStore * @return a textual indication of whether the remove operation succeeded */ public String remove() { // first unregister each participant of this action Iterator<LogRecordWrapper> i = participants.iterator(); while (i.hasNext()) { LogRecordWrapper w = i.next(); w.remove(false); i.remove(); } try { if (!StoreManager.getRecoveryStore().remove_committed(getUid(), getType())) return "Attempt to remove transaction failed"; _uidWrapper.unregister(); return "Transaction successfully removed"; } catch (ObjectStoreException e) { return "Unable to remove transaction: " + e.getMessage(); } finally { _uidWrapper.probe(); } }
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);
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()); }
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 remove(boolean reprobe) throws MBeanException { if (parent != null) { parent.remove(this); _uidWrapper.unregister(); if (reprobe) _uidWrapper.probe(); } return "Record successfully removed"; }
@Override protected LogRecordWrapper createParticipant(AbstractRecord rec, ParticipantStatus listType) { if (rec instanceof com.arjuna.ats.internal.jta.resources.arjunacore.XAResourceRecord) return new com.arjuna.ats.internal.jta.tools.osb.mbean.jta.XAResourceRecordBean(this, rec, listType); else if (rec instanceof com.arjuna.ats.internal.jta.resources.arjunacore.CommitMarkableResourceRecord) return new com.arjuna.ats.internal.jta.tools.osb.mbean.jta.CommitMarkableResourceRecordBean(this, rec, listType); else return super.createParticipant(rec, listType); } }