use of org.omg.CORBA.BAD_OPERATION in project narayana by jbosstm.
the class CurrentImple method resume.
/**
* To support checked transactions we can only resume if the action is local
* or we received it implicitly.
*
* If the control refers to a nested transaction then we must recreate the
* entire hierarchy, i.e., the effect of a suspend/resume on the same
* control should be the same as never calling suspend in the first place.
*
* If the control is for a local transaction then it is simple to recreate
* the hierarchy. Otherwise we rely upon the PropagationContext to recreate
* it.
*
* If this control is a "proxy" then create a new proxy instance, so we can
* delete proxies whenever suspend is called.
*
* Should check if "new" transaction is not actually the current one anyway.
* If so, just return. The spec. doesn't mention what to do in this case, so
* for now we go to the overhead of the work regardless.
*/
public void resume(Control which) throws InvalidControl, SystemException {
if (jtsLogger.logger.isTraceEnabled()) {
jtsLogger.logger.trace("CurrentImple::resume ( " + which + " )");
}
/*
* We must now "forget" any current transaction information. This is
* because when we end this transaction we must be associated with no
* transaction.
*/
_theManager.purgeActions();
if (// if null then return
which == null) {
ThreadAssociationControl.updateAssociation(null, TX_RESUMED);
return;
}
/*
* Must duplicate because it is an 'in' parameter which we want to keep.
*/
org.omg.CosTransactions.Control cont = which;
boolean invalidControl = false;
try {
Coordinator coord = cont.get_coordinator();
if (!coord.is_top_level_transaction()) {
/*
* Is the Control an ActionControl? If so then it has methods to
* allow us to get the parent directly. Otherwise, rely on the
* PropagationContext.
*/
ActionControl actControl = null;
try {
actControl = com.arjuna.ArjunaOTS.ActionControlHelper.narrow(cont);
if (actControl == null)
throw new BAD_PARAM();
} catch (Exception e) {
/*
* Not an ActionControl.
*/
actControl = null;
}
if (actControl != null) {
invalidControl = _theManager.addActionControlHierarchy(actControl);
} else {
invalidControl = _theManager.addRemoteHierarchy(cont);
}
}
coord = null;
} catch (OBJECT_NOT_EXIST one) {
// throw new InvalidControl();
} catch (// JacORB 1.4.5 bug
UNKNOWN ue) {
} catch (// JacORB 2.0 beta 2 bug
org.omg.CORBA.OBJ_ADAPTER oae) {
} catch (SystemException sysEx) {
throw new InvalidControl();
} catch (UserException usrEx) {
throw new InvalidControl();
} catch (NullPointerException npx) {
throw new InvalidControl();
} catch (Exception ex) {
throw new BAD_OPERATION("CurrentImple.resume: " + ex.toString());
}
try {
if (!invalidControl) {
ControlWrapper wrap = new ControlWrapper(cont);
ThreadAssociationControl.updateAssociation(wrap, TX_RESUMED);
_theManager.pushAction(wrap);
}
} catch (NullPointerException npx) {
invalidControl = true;
}
cont = null;
if (invalidControl)
throw new InvalidControl();
}
use of org.omg.CORBA.BAD_OPERATION in project narayana by jbosstm.
the class ServerNestedAction method commit_subtransaction.
public void commit_subtransaction(Coordinator parent) throws SystemException {
if (jtsLogger.logger.isTraceEnabled()) {
jtsLogger.logger.trace("ServerNestedAction::commit_subtransaction : " + _theUid);
}
if (_theControl == null) {
jtsLogger.i18NLogger.warn_orbspecific_interposition_resources_arjuna_nullcontrol_1("ServerNestedAction.commit_subtransaction");
throw new INVALID_TRANSACTION(ExceptionCodes.SERVERAA_NO_CONTROL, CompletionStatus.COMPLETED_NO);
}
if (_theControl.isWrapper()) {
destroyResource();
return;
}
ServerTransaction theTransaction = (ServerTransaction) _theControl.getImplHandle();
try {
theTransaction.commit(false);
} catch (TRANSACTION_ROLLEDBACK e1) {
jtsLogger.i18NLogger.warn_orbspecific_interposition_resources_arjuna_generror_2("ServerNestedAction.commit_subtransaction", e1);
throw e1;
} catch (INVALID_TRANSACTION e5) {
jtsLogger.i18NLogger.warn_orbspecific_interposition_resources_arjuna_generror_2("ServerNestedAction.commit_subtransaction", e5);
throw e5;
} catch (HeuristicMixed e2) {
jtsLogger.i18NLogger.warn_orbspecific_interposition_resources_arjuna_generror_2("ServerNestedAction.commit_subtransaction", e2);
throw new BAD_OPERATION(ExceptionCodes.HEURISTIC_COMMIT, CompletionStatus.COMPLETED_MAYBE);
} catch (HeuristicHazard e3) {
jtsLogger.i18NLogger.warn_orbspecific_interposition_resources_arjuna_generror_2("ServerNestedAction.commit_subtransaction", e3);
throw new BAD_OPERATION(ExceptionCodes.HEURISTIC_COMMIT, CompletionStatus.COMPLETED_MAYBE);
} catch (SystemException e4) {
jtsLogger.i18NLogger.warn_orbspecific_interposition_resources_arjuna_generror_2("ServerNestedAction.commit_subtransaction", e4);
throw e4;
} catch (Exception e5) {
jtsLogger.i18NLogger.warn_orbspecific_interposition_resources_arjuna_generror_2("ServerNestedAction.commit_subtransaction", e5);
throw new UNKNOWN(e5.toString());
} finally {
ThreadActionData.popAction();
destroyResource();
}
}
use of org.omg.CORBA.BAD_OPERATION in project narayana by jbosstm.
the class ServerSynchronization method after_completion.
public void after_completion(org.omg.CosTransactions.Status status) throws SystemException {
if (_theTransaction == null) {
destroy();
throw new BAD_OPERATION(ExceptionCodes.NO_TRANSACTION, CompletionStatus.COMPLETED_NO);
} else {
/*
* Check that the given status is the same as our status. It should
* be!
*/
org.omg.CosTransactions.Status myStatus = org.omg.CosTransactions.Status.StatusUnknown;
try {
myStatus = _theTransaction.get_status();
} catch (Exception e) {
myStatus = org.omg.CosTransactions.Status.StatusUnknown;
}
if (myStatus != status) {
jtsLogger.i18NLogger.warn_orbspecific_interposition_resources_stateerror("ServerSynchronization.after_completion", Utility.stringStatus(myStatus), Utility.stringStatus(status));
if (myStatus == Status.StatusActive) {
try {
_theTransaction.rollback();
} catch (Exception e) {
}
try {
status = _theTransaction.get_status();
} catch (Exception e) {
status = Status.StatusUnknown;
}
}
}
_theTransaction.doAfterCompletion(status);
}
/*
* Now dispose of self.
*/
destroy();
}
use of org.omg.CORBA.BAD_OPERATION in project narayana by jbosstm.
the class InterpositionServerRequestInterceptorImpl method suspendContext.
/*
* If there is a thread id associated with PICurrent then it will
* have been placed there by a server-side thread which executed in
* the application object and needed to associate an imported
* transaction with itself. In which case we need to do the
* equivalent of a suspend to remove the thread from Current and
* from the current transaction.
*/
private void suspendContext(ServerRequestInfo request_info) throws SystemException, InvalidSlot {
if (jtsLogger.logger.isTraceEnabled()) {
trace_request("suspendContext", request_info);
}
Any data = request_info.get_slot(_dataSlot);
if ((data != null) && (data.type().kind().value() != TCKind._tk_null)) {
String threadId = null;
try {
if ((threadId = data.extract_string()) != null) {
// ControlWrapper ctx = OTSImpleManager.systemCurrent().contextManager().popAction(threadId);
ControlWrapper ctx = OTSImpleManager.current().contextManager().popAction(threadId);
// OTSImpleManager.systemCurrent().contextManager().purgeActions(threadId);
OTSImpleManager.current().contextManager().purgeActions(threadId);
}
} catch (BAD_OPERATION bex) {
// not a string, so still a pgcts
}
request_info.set_slot(_dataSlot, null);
}
}
use of org.omg.CORBA.BAD_OPERATION in project narayana by jbosstm.
the class ContextServerRequestInterceptorImpl method suspendContext.
/*
* If there is a thread id associated with PICurrent then it will
* have been placed there by a server-side thread which executed in
* the application object and needed to associate an imported
* transaction with itself. In which case we need to do the
* equivalent of a suspend to remove the thread from Current and
* from the current transaction.
*/
private void suspendContext(ServerRequestInfo request_info) throws SystemException, InvalidSlot {
if (jtsLogger.logger.isTraceEnabled()) {
jtsLogger.logger.trace("ContextServerRequestInterceptorImpl.suspendContext ( " + request_info.operation() + " )");
}
Any data = request_info.get_slot(_dataSlot);
if ((data != null) && (data.type().kind().value() != TCKind._tk_null)) {
String threadId = null;
try {
if ((threadId = data.extract_string()) != null) {
ControlWrapper ctx = OTSImpleManager.current().contextManager().popAction(threadId);
OTSImpleManager.current().contextManager().purgeActions(threadId);
if (ctx != null) {
try {
OTSManager.destroyControl(ctx.getControl());
ctx = null;
} catch (Exception e) {
jtsLogger.i18NLogger.warn_orbspecific_javaidl_interceptors_context_srie("ContextServerRequestInterceptorImpl.suspendContext", e);
throw new UNKNOWN(e.toString());
}
}
}
} catch (BAD_OPERATION be) {
// not a string, so still a pgctx
}
request_info.set_slot(_dataSlot, null);
}
}
Aggregations