Exemplo n.º 1
0
  protected int doForget(Xid xid) throws XAException {
    int returnVal = -1;
    int e = 0;

    synchronized (this.physicalConn) {
      synchronized (this) {
        try {
          if (OracleXid.isLocalTransaction(xid)) {
            int i = 24771;
            return i;
          }
          int resumeReturn = doStart(xid, 134217728);

          if (resumeReturn != 24756) {
            if (resumeReturn == 0) {
              try {
                doEnd(xid, 0);
              } catch (Exception ex) {
              }
            }

            if ((resumeReturn == 0)
                || (resumeReturn == 2079)
                || (resumeReturn == 24754)
                || (resumeReturn == 24761)
                || (resumeReturn == 24774)
                || (resumeReturn == 24776)
                || (resumeReturn == 25351)) {
              e = 24769;
              return e;
            }
            if (resumeReturn == 24752) {
              e = 24771;
              return e;
            }
            e = resumeReturn;
            return e;
          }
          returnVal = kputxrec(xid, 4, 1);
        } finally {
        }
      }
    }

    return returnVal;
  }
Exemplo n.º 2
0
  protected int doStart(Xid xid, int flag) throws XAException {
    int returnVal = -1;

    synchronized (this.physicalConn) {
      synchronized (this) {
        if (this.isTransLoose) {
          flag |= 65536;
        }

        int swtch = flag & 0x8200000;

        if ((swtch == 134217728) && (OracleXid.isLocalTransaction(xid))) {
          return 0;
        }

        this.applicationValueArr[0] = 0;
        try {
          try {
            T4CTTIOtxse otxse = this.physicalConn.otxse;
            byte[] xidxid = null;
            byte[] gtrid = xid.getGlobalTransactionId();
            byte[] bqual = xid.getBranchQualifier();

            int gtrid_l = 0;
            int bqual_l = 0;

            if ((gtrid != null) && (bqual != null)) {
              gtrid_l = Math.min(gtrid.length, 64);
              bqual_l = Math.min(bqual.length, 64);
              xidxid = new byte['\u0080'];

              System.arraycopy(gtrid, 0, xidxid, 0, gtrid_l);
              System.arraycopy(bqual, 0, xidxid, gtrid_l, bqual_l);
            }

            int t4cflag = 0;

            if (((flag & 0x200000) != 0) || ((flag & 0x8000000) != 0)) t4cflag |= 4;
            else {
              t4cflag |= 1;
            }
            if ((flag & 0x100) != 0) {
              t4cflag |= 256;
            }
            if ((flag & 0x200) != 0) {
              t4cflag |= 512;
            }
            if ((flag & 0x400) != 0) {
              t4cflag |= 1024;
            }
            if ((flag & 0x10000) != 0) {
              t4cflag |= 65536;
            }
            this.physicalConn.sendPiggyBackedMessages();
            otxse.marshal(
                1, null, xidxid, xid.getFormatId(), gtrid_l, bqual_l, this.timeout, t4cflag);

            byte[] ctx = otxse.receive(this.applicationValueArr);

            if (ctx != null) {
              this.context = ctx;
            }
            returnVal = 0;
          } catch (IOException ioe) {
            DatabaseError.throwSqlException(ioe);
          }

        } catch (SQLException s) {
          returnVal = s.getErrorCode();

          if (returnVal == 0) {
            throw new XAException(-6);
          }
        }
      }
    }

    return returnVal;
  }