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; }
static synchronized void getXARecoveryResourceMBeans(UidWrapper uidWrapper) { if (xaRecoveryResourceMBeans == null) { xaRecoveryResourceMBeans = new ArrayList<XARecoveryResourceMBean>(); List<UidWrapper> wrappers = uidWrapper.probe(XAResourceRecord.typeName()); if (wrappers != null) { for (UidWrapper w : wrappers) { OSEntryBean bean = w.getMBean(); if (bean != null && bean instanceof XARecoveryResourceMBean) xaRecoveryResourceMBeans.add((XARecoveryResourceMBean) bean); } } } }
public void createAndRegisterMBean() { if (mbean == null) createMBean(); register(); }
public String remove(boolean reprobe) throws MBeanException { if (parent != null) { parent.remove(this); _uidWrapper.unregister(); if (reprobe) _uidWrapper.probe(); } return "Record successfully removed"; }
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(); } }
public boolean doRemove() { try { if (StoreManager.getRecoveryStore().remove_committed(getUid(), _uidWrapper.getType())) return true; if (tsLogger.logger.isDebugEnabled()) tsLogger.logger.debugf("%s %s", REMOVE_NOK_1, getUid().toString()); return false; } catch (ObjectStoreException e) { if (tsLogger.logger.isDebugEnabled()) tsLogger.logger.debugf("%s %s - %s", REMOVE_NOK_1, getUid().toString(), e.getMessage()); return false; } }
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; }
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);
/** * 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 UidWrapper findUid(String uid) { for (Map.Entry<String, List<UidWrapper>> typeEntry : allUids.entrySet()) for (UidWrapper w : typeEntry.getValue()) if (w.getUid().stringForm().equals(uid)) return w; return null; } ;
protected ActionBeanWrapperInterface createWrapper(UidWrapper w, boolean activate) { GenericAtomicActionWrapper action = new GenericAtomicActionWrapper(w.getClassName(), w); if (activate) action.activate(); return action; }
public StringBuilder dump(StringBuilder sb) { for (Map.Entry<String, List<UidWrapper>> typeEntry : allUids.entrySet()) { sb.append(typeEntry.getKey()).append('\n'); for (UidWrapper uid : typeEntry.getValue()) uid.toString("\t", sb); } return sb; }
private JTAActionBean getTransactionBean(ObjStoreBrowser osb, TransactionImple tx, boolean present) { // there should be one MBean corresponding to the Transaction tx UidWrapper w = osb.findUid(tx.get_uid()); if (!present) { assertNull(w); return null; } assertNotNull(w); OSEntryBean ai = w.getMBean(); assertNotNull(ai); // the MBean should wrap a JTAActionBean assertTrue(ai instanceof JTAActionBean); return (JTAActionBean) ai; }
private void registerMBeans() { for (List<UidWrapper> uids : registeredMBeans.values()) { for (UidWrapper w : uids) w.register(); } }
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(); } }
public boolean doRemove() { try { if (StoreManager.getRecoveryStore().remove_committed(getUid(), _uidWrapper.getType())) return true; if (tsLogger.logger.isDebugEnabled()) tsLogger.logger.debugf("%s %s", REMOVE_NOK_1, getUid().toString()); return false; } catch (ObjectStoreException e) { if (tsLogger.logger.isDebugEnabled()) tsLogger.logger.debugf("%s %s - %s", REMOVE_NOK_1, getUid().toString(), e.getMessage()); return false; } }
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; }