public void cancel() throws UnknownTransactionException, SystemException, WrongStateException {
    TxContextImple ctx = null;

    try {
      ctx = (TxContextImple) _ctxManager.suspend();
      if (ctx == null) {
        throw new WrongStateException();
      }

      final String id = ctx.identifier();
      final W3CEndpointReference terminatorCoordinatorRPC = getTerminationCoordinatorRPC(ctx);

      BusinessActivityTerminatorRPCStub terminatorRPCStub =
          new BusinessActivityTerminatorRPCStub(id, terminatorCoordinatorRPC);

      terminatorRPCStub.cancel();
    } catch (SystemException ex) {
      throw ex;
    } catch (WrongStateException ex) {
      throw ex;
    } catch (UnknownTransactionException ex) {
      throw ex;
    } catch (Exception ex) {
      ex.printStackTrace();

      throw new SystemException(ex.toString());
    } finally {
      tidyup();
    }
  }
  public void complete() throws UnknownTransactionException, SystemException, WrongStateException {
    try {
      final TxContextImple ctx = ((TxContextImple) _ctxManager.currentTransaction());
      if (ctx == null) {
        throw new WrongStateException();
      }
      final String id = ctx.identifier();
      final W3CEndpointReference terminatorCoordinatorRPC = getTerminationCoordinatorRPC(ctx);

      BusinessActivityTerminatorRPCStub terminatorRPCStub =
          new BusinessActivityTerminatorRPCStub(id, terminatorCoordinatorRPC);

      terminatorRPCStub.complete();
    } catch (SystemException ex) {
      throw ex;
    } catch (UnknownTransactionException ex) {
      throw ex;
    } catch (WrongStateException ex) {
      throw ex;
    } catch (Exception ex) {
      throw new SystemException(ex.toString());
    }
  }