Search in sources :

Example 1 with Uid

use of com.arjuna.ats.arjuna.common.Uid in project narayana by jbosstm.

the class AITMatrixImpl04 method restore_state.

public boolean restore_state(InputObjectState objectState, int objectType) {
    super.restore_state(objectState, objectType);
    try {
        for (int x = 0; x < _width; x++) {
            for (int y = 0; y < _height; y++) {
                Uid uid = UidHelper.unpackFrom(objectState);
                _values[x][y] = Element.obtain(uid);
            }
        }
        return true;
    } catch (Exception exception) {
        System.err.println("AITMatrixImpl04.restore_state: " + exception);
        return false;
    }
}
Also used : Uid(com.arjuna.ats.arjuna.common.Uid)

Example 2 with Uid

use of com.arjuna.ats.arjuna.common.Uid in project narayana by jbosstm.

the class AITMatrixImpl04 method restore_state.

public boolean restore_state(InputObjectState objectState, int objectType) {
    super.restore_state(objectState, objectType);
    try {
        for (int x = 0; x < _width; x++) {
            for (int y = 0; y < _height; y++) {
                Uid uid = UidHelper.unpackFrom(objectState);
                _values[x][y] = Element.obtain(uid);
            }
        }
        return true;
    } catch (Exception exception) {
        System.err.println("AITMatrixImpl04.restore_state: " + exception);
        return false;
    }
}
Also used : Uid(com.arjuna.ats.arjuna.common.Uid)

Example 3 with Uid

use of com.arjuna.ats.arjuna.common.Uid in project narayana by jbosstm.

the class TransactionLog method getIds.

/**
 * Get a list object ids for a given object type
 *
 * @param ids holder for the returned uids
 * @param objectType The type of object to search in the recoveryStore for
 * @return all objects of the given type
 * @throws ObjectStoreException the recoveryStore implementation was unable retrieve all types of objects
 */
public Collection<Uid> getIds(Collection<Uid> ids, String objectType) throws ObjectStoreException {
    if (ids == null)
        ids = new ArrayList<Uid>();
    InputObjectState types = new InputObjectState();
    if (recoveryStore.allTypes(types)) {
        String theName;
        try {
            boolean endOfList = false;
            while (!endOfList) {
                theName = types.unpackString();
                if (theName.compareTo("") == 0)
                    endOfList = true;
                else {
                    if (objectType != null && !theName.equals(objectType))
                        continue;
                    InputObjectState uids = new InputObjectState();
                    if (recoveryStore.allObjUids(theName, uids)) {
                        Uid theUid = new Uid(Uid.nullUid());
                        try {
                            boolean endOfUids = false;
                            while (!endOfUids) {
                                theUid = UidHelper.unpackFrom(uids);
                                if (theUid.equals(Uid.nullUid()))
                                    endOfUids = true;
                                else
                                    ids.add(theUid);
                            }
                        } catch (Exception e) {
                        // end of uids!
                        }
                    }
                    System.out.println();
                }
            }
        } catch (Exception e) {
            System.err.println(e);
        // end of list!
        }
    }
    return ids;
}
Also used : InputObjectState(com.arjuna.ats.arjuna.state.InputObjectState) Uid(com.arjuna.ats.arjuna.common.Uid) ArrayList(java.util.ArrayList) ObjectStoreException(com.arjuna.ats.arjuna.exceptions.ObjectStoreException)

Example 4 with Uid

use of com.arjuna.ats.arjuna.common.Uid in project narayana by jbosstm.

the class ObjectUidStore method loadUid.

public static Uid loadUid(String objectName) throws Exception {
    Uid objectUid = null;
    Properties objectUids = new Properties();
    FileInputStream objectUidsFileInputStream = new FileInputStream("ObjectUids");
    objectUids.load(objectUidsFileInputStream);
    objectUidsFileInputStream.close();
    objectUid = new Uid((String) objectUids.get(objectName));
    return objectUid;
}
Also used : Uid(com.arjuna.ats.arjuna.common.Uid) Properties(java.util.Properties) FileInputStream(java.io.FileInputStream)

Example 5 with Uid

use of com.arjuna.ats.arjuna.common.Uid in project narayana by jbosstm.

the class ParticipantsManagerTestCase method testReportHeuristic.

@Test
public void testReportHeuristic() throws MalformedURLException {
    final String participantId = new Uid().toString();
    registerParticipant(participantId, new LoggingParticipant(new Prepared()));
    final ParticipantInformation participantInformation = ParticipantsContainer.getInstance().getParticipantInformation(participantId);
    participantInformation.setStatus(TxStatus.TransactionPrepared.name());
    participantsManager.reportHeuristic(participantId, HeuristicType.HEURISTIC_ROLLBACK);
    Assert.assertEquals(TxStatus.TransactionHeuristicRollback.name(), participantInformation.getStatus());
}
Also used : LoggingParticipant(org.jboss.narayana.rest.integration.test.common.LoggingParticipant) Uid(com.arjuna.ats.arjuna.common.Uid) Prepared(org.jboss.narayana.rest.integration.api.Prepared) ParticipantInformation(org.jboss.narayana.rest.integration.ParticipantInformation) Test(org.junit.Test)

Aggregations

Uid (com.arjuna.ats.arjuna.common.Uid)402 Test (org.junit.Test)185 InputObjectState (com.arjuna.ats.arjuna.state.InputObjectState)83 OutputObjectState (com.arjuna.ats.arjuna.state.OutputObjectState)74 XidImple (com.arjuna.ats.jta.xa.XidImple)71 ObjectStoreException (com.arjuna.ats.arjuna.exceptions.ObjectStoreException)57 IOException (java.io.IOException)48 Xid (javax.transaction.xa.Xid)44 XAException (javax.transaction.xa.XAException)40 SubordinateTransaction (com.arjuna.ats.internal.jta.transaction.arjunacore.jca.SubordinateTransaction)32 AtomicAction (com.arjuna.ats.arjuna.AtomicAction)31 RecoveryStore (com.arjuna.ats.arjuna.objectstore.RecoveryStore)27 SoapFault11 (com.arjuna.webservices11.SoapFault11)22 Transaction (javax.transaction.Transaction)18 ObjectStoreEnvironmentBean (com.arjuna.ats.arjuna.common.ObjectStoreEnvironmentBean)17 Vector (java.util.Vector)17 XATerminator (javax.resource.spi.XATerminator)15 TransactionImporter (com.arjuna.ats.internal.jta.transaction.arjunacore.jca.TransactionImporter)14 Enumeration (java.util.Enumeration)13 SystemException (org.omg.CORBA.SystemException)13