/** * Extension point for other Bean implementations to provide an implementation bean for its participants. * For example @see com.arjuna.ats.internal.jta.tools.osb.mbean.jta.JTAActionBean * @param rec the record that should be represented by an MBean * @param listType the status of the record * @return the MBean implementation of the participant */ protected LogRecordWrapper createParticipant(AbstractRecord rec, ParticipantStatus listType) { return new LogRecordWrapper(this, rec, listType); }
public void setStatus(String newState) { doSetStatus(newState); }
public String getStatus() { if (isHeuristic()) { String type = getHeuristicStatus(); if (!type.equals(HeuristicStatus.UNKNOWN.name())) return type; } return listType.toString(); }
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); lw = createParticipant(rec, listType); lw.activate(); participants.add(lw);
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 boolean removeRecords(RecordList rl, LogRecordWrapper logRecordWrapper) { if (rl != null && rl.size() > 0) { AbstractRecord ar = logRecordWrapper.getRecord(); boolean forgotten = ar.forgetHeuristic(); boolean removeAllowed = arjPropertyManager.getObjectStoreEnvironmentBean().isIgnoreMBeanHeuristics(); if (forgotten || removeAllowed) { // remove the transaction log for the record if (rl.remove(ar)) { return true; } } } return false; }
/** * 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(); } }
/** * unregister this bean (and its participants) with the MBeanServer */ public void unregister() { for (LogRecordWrapper p : participants) JMXServer.getAgent().unregisterMBean(p.getName()); super.unregister(); }
@Override public void remove(LogRecordWrapper logRecordWrapper) { RecordList rl = getRecords(logRecordWrapper.getListType()); if (rl != null && rl.size() > 0) { if (rl.remove(logRecordWrapper.getRecord())) { doUpdateState(); // rewrite the list } } }
/** * register this bean (and its participants) with the MBeanServer */ public void register() { super.register(); for (LogRecordWrapper p : participants) JMXServer.getAgent().registerMBean(p.getName(), p); }
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 boolean activate() { boolean ok = super.activate(); XAResource xares = (XAResource) rec.value(); className = rec.getClass().getName(); if (rec instanceof XAResourceRecord) { XAResourceRecord xarec = (XAResourceRecord) rec; eisProductName = xarec.getProductName(); eisProductVersion = xarec.getProductVersion(); jndiName = xarec.getJndiName(); } if (xares != null) { className = xares.getClass().getName(); try { timeout = xares.getTransactionTimeout(); } catch (Exception e) { } } return ok; }
@Override public void remove(LogRecordWrapper logRecordWrapper) { if (logRecordWrapper.removeFromList(getRecords(logRecordWrapper.getListType()))) { doUpdateState(); // rewrite the list } } }
@Override public String remove() { return remove(true); } }
public LogRecordWrapper(ActionBean parent, AbstractRecord rec, ParticipantStatus listType, UidWrapper wrapper) { super(wrapper); init(parent, rec, listType); }
/** * See if there is participant Bean corresponding to the given record * @param rec the record for the target participant * @return the bean corresponding to the requested record */ public LogRecordWrapper getParticipant(AbstractRecord rec) { for (LogRecordWrapper w : participants) if (w.getRecord().equals(rec)) return w; return null; }
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 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 boolean removeRecords(RecordList rl, LogRecordWrapper logRecordWrapper) { if (rl != null && rl.size() > 0) { AbstractRecord ar = logRecordWrapper.getRecord(); boolean forgotten = ar.forgetHeuristic(); boolean removeAllowed = arjPropertyManager.getObjectStoreEnvironmentBean().isIgnoreMBeanHeuristics(); if (forgotten || removeAllowed) { // remove the transaction log for the record if (rl.remove(ar)) { return true; } } } return false; }
/** * 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(); } }