Search in sources :

Example 1 with RESTRecord

use of org.jboss.jbossts.star.resource.RESTRecord in project narayana by jbosstm.

the class Coordinator method getRecoveringTransactions.

private static Map<String, RecoveringTransaction> getRecoveringTransactions(Map<String, Transaction> transactions) {
    Map<String, RecoveringTransaction> recoveringTransactions = new ConcurrentHashMap<String, RecoveringTransaction>();
    for (Uid uid : getUids(new HashSet<Uid>(), REST_TXN_TYPE)) {
        String key = uid.fileStringForm();
        RecoveringTransaction txn = new RecoveringTransaction(uid);
        try {
            // so it needs activate in order to make it available to anyone that wants to obtain it:
            if (txn.activate()) {
                for (RESTRecord r : txn.getParticipants(new ArrayList<RESTRecord>())) {
                    Map<String, String> links = new HashMap<String, String>();
                    links.put(TxLinkNames.PARTICIPANT_RECOVERY, r.getRecoveryURI());
                    links.put(TxLinkNames.TRANSACTION, r.getTxId());
                    participants.put(r.getCoordinatorURI(), new HashMap<>(links));
                }
            }
        } catch (Throwable e) {
            log.warnf("Could not reactivate pending transaction %s (reason: %s)", txn.get_uid(), e.getMessage());
        }
        recoveringTransactions.put(key, txn);
        transactions.put(key, txn);
    }
    return recoveringTransactions;
}
Also used : Uid(com.arjuna.ats.arjuna.common.Uid) RecoveringTransaction(org.jboss.jbossts.star.resource.RecoveringTransaction) RESTRecord(org.jboss.jbossts.star.resource.RESTRecord) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap)

Aggregations

Uid (com.arjuna.ats.arjuna.common.Uid)1 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)1 RESTRecord (org.jboss.jbossts.star.resource.RESTRecord)1 RecoveringTransaction (org.jboss.jbossts.star.resource.RecoveringTransaction)1