use of org.omg.CORBA.NO_MEMORY in project narayana by jbosstm.
the class Helper method getUid.
public static final Uid getUid(UidCoordinator coord) {
if (coord == null)
return Uid.nullUid();
String theUid = null;
Uid uid = null;
for (int i = 0; i < 1; i++) {
try {
theUid = coord.uid();
uid = new Uid(theUid);
theUid = null;
return uid;
} catch (OutOfMemoryError e) {
System.gc();
}
}
throw new NO_MEMORY(0, CompletionStatus.COMPLETED_NO);
}
use of org.omg.CORBA.NO_MEMORY in project narayana by jbosstm.
the class TransactionFactoryImple method createLocal.
/**
* This creates a local instance of a transaction control, but does not
* register it with the ORB. Either call its getControl method directly, or
* use the create method of the factory.
*/
public ControlImple createLocal(int time_out) throws SystemException {
if (jtsLogger.logger.isTraceEnabled()) {
jtsLogger.logger.trace("TransactionFactoryImple::createLocal ( " + time_out + " )");
}
try {
ControlImple tranControl = new ControlImple((Control) null, (ArjunaTransactionImple) null);
int theTimeout = time_out;
if (theTimeout == 0)
theTimeout = TxControl.getDefaultTimeout();
if (theTimeout > 0) {
/*
* Currently we do not remove controls from the list once they
* have terminated. We should to save time and space!
*/
TransactionReaper reaper = TransactionReaper.transactionReaper();
reaper.insert(new ControlWrapper((ControlImple) tranControl), theTimeout);
}
return tranControl;
} catch (OutOfMemoryError e) {
/*
* Rather than try again after running gc simply return and let the
* user deal with it. May help with memory!
*/
System.gc();
throw new NO_MEMORY(0, CompletionStatus.COMPLETED_NO);
}
}
use of org.omg.CORBA.NO_MEMORY in project narayana by jbosstm.
the class CurrentImple method begin.
public void begin() throws SubtransactionsUnavailable, SystemException {
ControlWrapper currentAction = _theManager.current();
if (// no current, so create top-level action
currentAction == null) {
if (jtsLogger.logger.isTraceEnabled()) {
jtsLogger.logger.trace("CurrentImple::begin - creating new top-level transaction.");
}
if (OTSImpleManager.localFactory())
currentAction = new ControlWrapper(OTSImpleManager.factory().createLocal(get_timeout()));
else
currentAction = new ControlWrapper(OTSImpleManager.get_factory().create(get_timeout()));
} else {
if (jtsLogger.logger.isTraceEnabled()) {
jtsLogger.logger.trace("CurrentImple::begin - creating new subtransaction.");
}
try {
currentAction = currentAction.create_subtransaction();
} catch (Unavailable ex) {
throw new INVALID_TRANSACTION(ExceptionCodes.UNAVAILABLE_COORDINATOR, CompletionStatus.COMPLETED_NO);
} catch (Inactive e) {
throw new INVALID_TRANSACTION(ExceptionCodes.INACTIVE_TRANSACTION, CompletionStatus.COMPLETED_NO);
} catch (NO_MEMORY nme) {
System.gc();
throw nme;
} catch (SystemException sysEx) {
throw new INVALID_TRANSACTION(ExceptionCodes.INACTIVE_TRANSACTION, CompletionStatus.COMPLETED_NO);
} catch (OutOfMemoryError me) {
System.gc();
throw new NO_MEMORY(0, CompletionStatus.COMPLETED_NO);
}
}
_theManager.pushAction(currentAction);
try {
ThreadAssociationControl.updateAssociation(currentAction, TX_BEGUN);
} catch (Exception e) {
try {
rollback_only();
} catch (Exception ex) {
}
}
currentAction = null;
}
Aggregations