Examples of TransactionConfig


Examples of com.sleepycat.je.TransactionConfig

                locker.addToHandleMaps(new Long(nameLN.getNodeId()),
                                       databaseHandle);
            }

            /* Insert it into id -> name db, in auto commit mode. */
            autoTxn = new AutoTxn(envImpl, new TransactionConfig());
            idCursor = new CursorImpl(idDatabase, autoTxn);
            idCursor.setAllowEviction(allowEviction);
            idCursor.putLN(newId.getBytes(), new MapLN(newDb), false);
            operationOk = true;
  } catch (UnsupportedEncodingException UEE) {
View Full Code Here

Examples of com.sleepycat.je.TransactionConfig

       
        if (db.getId().equals(ID_DB_ID) ||
            db.getId().equals(NAME_DB_ID)) {
            envImpl.logMapTreeRoot();
        } else {
            Locker locker = new AutoTxn(envImpl, new TransactionConfig());
            CursorImpl cursor = new CursorImpl(idDatabase, locker);
            boolean operationOk = false;
            try {
                DatabaseEntry keyDbt =
        new DatabaseEntry(db.getId().getBytes());
    MapLN mapLN = null;

    /*
     * Retry indefinitely in the face of lock timeouts since the
     * lock on the MapLN is only supposed to be held for short
     * periods.
     */
    while (true) {
        try {
      boolean searchOk = (cursor.searchAndPosition
              (keyDbt, new DatabaseEntry(),
               SearchMode.SET, LockType.WRITE) &
              CursorImpl.FOUND) != 0;
      if (!searchOk) {
                            throw new DatabaseException(
                                "can't find database " + db.getId());
                        }
      mapLN = (MapLN)
          cursor.getCurrentLNAlreadyLatched(LockType.WRITE);
                        assert mapLN != null; /* Should be locked. */
        } catch (DeadlockException DE) {
      cursor.close();
      locker.operationEnd(false);
      locker = new AutoTxn(envImpl, new TransactionConfig());
      cursor = new CursorImpl(idDatabase, locker);
      continue;
        } finally {
      cursor.releaseBINs();
        }
View Full Code Here

Examples of com.sleepycat.je.TransactionConfig

                 * hold long term locks on the mapLN.
                 */
                CursorImpl idCursor = null;
                boolean operationOk = false;
                try {
                    autoTxn = new AutoTxn(envImpl, new TransactionConfig());
                    idCursor = new CursorImpl(idDatabase, autoTxn);
                    idCursor.putLN(newId.getBytes(),
                                   new MapLN(newDb), false);
                    operationOk = true;
                } finally {
View Full Code Here

Examples of com.sleepycat.je.TransactionConfig

        AutoTxn autoTxn = null;
        boolean operationOk = false;
        CursorImpl idCursor = null;
       
        try {
            autoTxn = new AutoTxn(envImpl, new TransactionConfig());
            idCursor = new CursorImpl(idDatabase, autoTxn);
            boolean found =
                (idCursor.searchAndPosition(new DatabaseEntry(id.getBytes()),
                                            null,
                                            SearchMode.SET,
View Full Code Here

Examples of com.sleepycat.je.TransactionConfig

            /* Insert the new db into id -> name map */
            CursorImpl idCursor = null;
            boolean operationOk = false;
            AutoTxn autoTxn = null;
            try {
                autoTxn = new AutoTxn(envImpl, new TransactionConfig());
                idCursor = new CursorImpl(idDatabase, autoTxn);
                idCursor.putLN(newId.getBytes(),
             new MapLN(newDb), false);
                operationOk = true;
            } finally {
View Full Code Here

Examples of com.sleepycat.je.TransactionConfig

         */
        long prepareId = reader.getTxnPrepareId();
        Long prepareIdL = new Long(prepareId);
        if (!committedTxnIds.contains(prepareIdL) &&
      !abortedTxnIds.contains(prepareIdL)) {
      TransactionConfig txnConf = new TransactionConfig();
      Txn preparedTxn = new Txn(env, txnConf, prepareId);
      preparedTxn.setLockTimeout(0);
      preparedTxns.put(prepareIdL, preparedTxn);
      env.getTxnManager().registerXATxn
          (reader.getTxnPrepareXid(), preparedTxn, true);
View Full Code Here

Examples of com.sleepycat.je.TransactionConfig

        dbConfig.setAllowCreate(true);
        db = env.openDatabase(null, "foo", dbConfig);
        LogManager logManager = envImpl.getLogManager();

        long lsn;
        Txn userTxn = new Txn(envImpl, new TransactionConfig());
        long txnId = userTxn.getId();

        for (int i = 0; i < numIters; i++) {
            /* Add a debug record just to be filler. */
            Tracer rec = new Tracer("Hello there, rec " + (i+1));
View Full Code Here

Examples of com.sleepycat.je.TransactionConfig

        /*
         * This test deadlocks a lot at degree 3 serialization.  In debugging
         * this I discovered it was not due to phantom prevention per se but
         * just to a change in timing.
         */
        TransactionConfig txnConfig = new TransactionConfig();
        runner.setTransactionConfig(txnConfig);

        /*
         * A thread to do put() and delete() via the primary, which will lock
         * the primary first then the secondary.  Uses transactions.
View Full Code Here

Examples of com.sleepycat.je.TransactionConfig

            /*
             * Make a user transaction, check lock and release.
             */
            beforeLock = mb.getCacheMemoryUsage();
            Txn userTxn = new Txn(envImpl, new TransactionConfig());
            lockGrant = userTxn.lock
                (ln.getNodeId(), LockType.READ,
                 DbInternal.dbGetDatabaseImpl(db)).
    getLockGrant();
            afterLock = mb.getCacheMemoryUsage();
View Full Code Here

Examples of com.sleepycat.je.TransactionConfig

        try {
            LN ln1 = new LN(new byte[0]);
            LN ln2 = new LN(new byte[0]);
                                         
            EnvironmentImpl envImpl = DbInternal.envGetEnvironmentImpl(env);
            Txn userTxn = new Txn(envImpl, new TransactionConfig());

            // get read lock 1
            LockGrantType lockGrant = userTxn.lock
                (ln1.getNodeId(), LockType.READ,
                 DbInternal.dbGetDatabaseImpl(db)).
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.