jtsLogger.logger.debug(DebugLevel.FUNCTIONS, VisibilityLevel.VIS_PUBLIC, com.arjuna.ats.jts.logging.FacilityCode.FAC_OTS, "ArjunaTransactionImple::register_resource ( "
+ r + " ) - called for " + get_uid());
}
if (r == null)
throw new BAD_PARAM(0, CompletionStatus.COMPLETED_NO);
currentStatus = determineStatus(this);
if (currentStatus != Status.StatusActive)
{
if (jtsLogger.logger.isDebugEnabled())
{
jtsLogger.logger.debug(DebugLevel.FUNCTIONS, VisibilityLevel.VIS_PUBLIC, com.arjuna.ats.jts.logging.FacilityCode.FAC_OTS, "ArjunaTransactionImple::register_resource - transaction not active: "
+ Utility.stringStatus(currentStatus));
}
if (currentStatus == Status.StatusMarkedRollback)
{
throw new TRANSACTION_ROLLEDBACK(
ExceptionCodes.MARKED_ROLLEDBACK,
CompletionStatus.COMPLETED_NO);
}
else
throw new Inactive();
}
AbstractRecord corbaRec = null;
BasicAction registerIn = this;
if (jtsLogger.logger.isDebugEnabled())
{
jtsLogger.logger.debug(DebugLevel.FUNCTIONS, VisibilityLevel.VIS_PUBLIC, com.arjuna.ats.jts.logging.FacilityCode.FAC_OTS, "ArjunaTransactionImple "
+ get_uid() + " ::register_resource: ");
}
//
// Creation of recovery coordinator (DBI)
//
//
// Pack the params:
// [0] = Transaction* this
//
int index = 0;
Object params[] = new Object[10];
params[index++] = this;
RecoveryCoordinator recoveryCoordinator = null;
Uid recoveryCoordinatorUid = null;
/*
* A RecoveryCoordinator can be null but only if the implementation
* throws NO_IMPLEMENT. If it tries to return null then that is
* considered an error and we will roll back the transaction.
*/
try
{
recoveryCoordinator = RecoveryCreator.createRecoveryCoordinator(r, params);
if (recoveryCoordinator == null)
throw new BAD_OPERATION(
"RecoveryCoordinator "
+ jtsLogger.logMesg.getString("com.arjuna.ats.internal.jts.orbspecific.coordinator.rcnotcreated"));
}
catch (NO_IMPLEMENT ex)
{
/*
* This is legal, and is meant to show that this ORB or
* configuration simply doesn't support crash recovery.
*/
recoveryCoordinator = null;
}
catch (SystemException e)
{
if (jtsLogger.loggerI18N.isWarnEnabled())
{
jtsLogger.loggerI18N.warn("com.arjuna.ats.internal.jts.orbspecific.coordinator.rccreate", new Object[]
{ get_uid(), e });
}
/*
* Set transaction to rollback only and re-throw exception.
*/
try
{
rollback_only();
}
catch (Inactive ex1)
{
}
catch (SystemException ex2)
{
if (jtsLogger.loggerI18N.isWarnEnabled())
{
jtsLogger.loggerI18N.warn("com.arjuna.ats.internal.jts.orbspecific.coordinator.rbofail", new Object[]
{ "ArjunaTransactionImple.register_resource", get_uid(), ex2 });
}
throw ex2;
}
throw e;
}
if (recoveryCoordinator != null)
{
//
// We got a RecoveryCoordinator, so unpack the other return values:
// [0] = RecoveryCoordinator Uid*
//
index = 0;
recoveryCoordinatorUid = (Uid) params[index++];
}
else
{
//
// We didn't get a RecoveryCoordinator, so we don't assume that
// the other return values have been populated.
//
recoveryCoordinatorUid = Uid.nullUid();
}
try
{
SubtransactionAwareResource staResource = org.omg.CosTransactions.SubtransactionAwareResourceHelper.narrow(r);
/*
* Some Orbs (e.g., Orbix) throw BAD_PARAM is the object in X.narrow
* is not of type X, whereas others (e.g., OrbPlus) simply return
* NULL!
*/
if (staResource != null)
{
if (jtsLogger.logger.isDebugEnabled())
{
jtsLogger.logger.debug(DebugLevel.FUNCTIONS, VisibilityLevel.VIS_PUBLIC, com.arjuna.ats.jts.logging.FacilityCode.FAC_OTS, "ArjunaTransactionImple::register_resource for "
+ get_uid()
+ " - subtransaction aware resource: YES");
}
/*
* If here the narrow was ok so we have a subtran aware
* resource.
*/
Coordinator coord = null;
if (parentHandle != null)
{
/*
* If we are a SubTranResource then we get registered with
* the current transaction and its parents upon completion.
* The first parameter to the record indicates whether we
* should be propagated (registered) with the parent
* transaction.
*/
coord = parentHandle.get_coordinator();
}
corbaRec = createOTSRecord(true, r, coord, recoveryCoordinatorUid);
coord = null;
staResource = null;
}
else
throw new BAD_PARAM(0, CompletionStatus.COMPLETED_NO);
}
catch (BAD_PARAM ex)
{
if (jtsLogger.logger.isDebugEnabled())
{