Search in sources :

Example 6 with OTSAbstractRecord

use of com.arjuna.ArjunaOTS.OTSAbstractRecord in project narayana by jbosstm.

the class ExtendedResourceRecord method otsRecord.

private final OTSAbstractRecord otsRecord(AbstractRecord absRec) {
    /*
		 * Is the abstract record an ExtendedResourceRecord ?
		 */
    OTSAbstractRecord resHandle = null;
    if ((absRec != null) && (absRec instanceof ExtendedResourceRecord)) {
        try {
            ExtendedResourceRecord theRecord = (ExtendedResourceRecord) absRec;
            ArjunaSubtranAwareResource theResource = theRecord.resourceHandle();
            resHandle = com.arjuna.ArjunaOTS.OTSAbstractRecordHelper.unchecked_narrow(theResource);
            theResource = null;
        } catch (Exception e) {
            jtsLogger.i18NLogger.warn_resources_errgenerr("ExtendedResourceRecord.otsRecord", e);
        }
    }
    return resHandle;
}
Also used : ArjunaSubtranAwareResource(com.arjuna.ArjunaOTS.ArjunaSubtranAwareResource) OTSAbstractRecord(com.arjuna.ArjunaOTS.OTSAbstractRecord) SystemException(org.omg.CORBA.SystemException) IOException(java.io.IOException)

Example 7 with OTSAbstractRecord

use of com.arjuna.ArjunaOTS.OTSAbstractRecord in project narayana by jbosstm.

the class ExtendedResourceRecord method typeIs.

public int typeIs() {
    OTSAbstractRecord resHandle = otsRecord();
    int r = RecordType.OTS_ABSTRACTRECORD;
    if (_cachedType == -1) {
        try {
            if ((resHandle != null) && !_endpointFailed)
                _cachedType = r = resHandle.type_id();
        } catch (Exception e) {
            r = RecordType.OTS_ABSTRACTRECORD;
            _endpointFailed = true;
            jtsLogger.i18NLogger.warn_resources_errtypefail("ExtendedResourceRecord.typeIs", Integer.toString(r));
        }
    } else
        r = _cachedType;
    resHandle = null;
    return r;
}
Also used : OTSAbstractRecord(com.arjuna.ArjunaOTS.OTSAbstractRecord) SystemException(org.omg.CORBA.SystemException) IOException(java.io.IOException)

Example 8 with OTSAbstractRecord

use of com.arjuna.ArjunaOTS.OTSAbstractRecord in project narayana by jbosstm.

the class ExtendedResourceRecord method shouldAlter.

public boolean shouldAlter(AbstractRecord absRec) {
    boolean result = false;
    OTSAbstractRecord resHandle = otsRecord();
    if ((resHandle != null) && !_endpointFailed) {
        OTSAbstractRecord rec = otsRecord(absRec);
        if (rec != null) {
            try {
                result = resHandle.shouldAlter(rec);
            } catch (OBJECT_NOT_EXIST ex) {
            // This is expected to happen whenever a resource has gone away, for example during a crash or if it has exited the 2PC process early by returning XA_RDONLY out of prepare
            } catch (Exception e) {
                _endpointFailed = true;
                jtsLogger.i18NLogger.warn_resources_errgenerr("ExtendedResourceRecord.shouldAlter", e);
            }
            rec = null;
        }
    }
    resHandle = null;
    return result;
}
Also used : OBJECT_NOT_EXIST(org.omg.CORBA.OBJECT_NOT_EXIST) OTSAbstractRecord(com.arjuna.ArjunaOTS.OTSAbstractRecord) SystemException(org.omg.CORBA.SystemException) IOException(java.io.IOException)

Example 9 with OTSAbstractRecord

use of com.arjuna.ArjunaOTS.OTSAbstractRecord in project narayana by jbosstm.

the class ExtendedResourceRecord method shouldMerge.

public boolean shouldMerge(AbstractRecord absRec) {
    boolean result = false;
    OTSAbstractRecord resHandle = otsRecord();
    if ((resHandle != null) && !_endpointFailed) {
        OTSAbstractRecord rec = otsRecord(absRec);
        if (rec != null) {
            try {
                result = resHandle.shouldMerge(rec);
            } catch (OBJECT_NOT_EXIST ex) {
            // This is expected to happen whenever a resource has gone away, for example during a crash or if it has exited the 2PC process early by returning XA_RDONLY out of prepare
            } catch (Exception e) {
                _endpointFailed = true;
                jtsLogger.i18NLogger.warn_resources_errgenerr("ExtendedResourceRecord.shouldMerge", e);
            }
            rec = null;
        }
    }
    resHandle = null;
    return result;
}
Also used : OBJECT_NOT_EXIST(org.omg.CORBA.OBJECT_NOT_EXIST) OTSAbstractRecord(com.arjuna.ArjunaOTS.OTSAbstractRecord) SystemException(org.omg.CORBA.SystemException) IOException(java.io.IOException)

Example 10 with OTSAbstractRecord

use of com.arjuna.ArjunaOTS.OTSAbstractRecord in project narayana by jbosstm.

the class ExtendedResourceRecord method shouldReplace.

public boolean shouldReplace(AbstractRecord absRec) {
    boolean result = recoveryReplace(absRec);
    OTSAbstractRecord resHandle = otsRecord();
    if ((resHandle != null) && !result && !_endpointFailed) {
        OTSAbstractRecord rec = otsRecord(absRec);
        if (rec != null) {
            try {
                result = resHandle.shouldReplace(rec);
            } catch (OBJECT_NOT_EXIST ex) {
            // This is expected to happen whenever a resource has gone away, for example during a crash or if it has exited the 2PC process early by returning XA_RDONLY out of prepare
            } catch (Exception e) {
                _endpointFailed = true;
                jtsLogger.i18NLogger.warn_resources_errgenerr("ExtendedResourceRecord.shouldReplace", e);
            }
            rec = null;
        }
    }
    resHandle = null;
    return result;
}
Also used : OBJECT_NOT_EXIST(org.omg.CORBA.OBJECT_NOT_EXIST) OTSAbstractRecord(com.arjuna.ArjunaOTS.OTSAbstractRecord) SystemException(org.omg.CORBA.SystemException) IOException(java.io.IOException)

Aggregations

OTSAbstractRecord (com.arjuna.ArjunaOTS.OTSAbstractRecord)10 SystemException (org.omg.CORBA.SystemException)10 IOException (java.io.IOException)9 OBJECT_NOT_EXIST (org.omg.CORBA.OBJECT_NOT_EXIST)6 ArjunaSubtranAwareResource (com.arjuna.ArjunaOTS.ArjunaSubtranAwareResource)2 Uid (com.arjuna.ats.arjuna.common.Uid)1 AbstractRecord (com.arjuna.ats.arjuna.coordinator.AbstractRecord)1 ExtendedResourceRecord (com.arjuna.ats.internal.jts.resources.ExtendedResourceRecord)1 ResourceRecord (com.arjuna.ats.internal.jts.resources.ResourceRecord)1 BAD_PARAM (org.omg.CORBA.BAD_PARAM)1