Package com.sleepycat.je

Examples of com.sleepycat.je.TransactionConfig


    private void openMappingDatabase(String mappingDbName)
        throws DatabaseException {

        final Locker locker =
            Txn.createLocalAutoTxn(envImpl, new TransactionConfig());

        try {
            DbTree dbTree = envImpl.getDbTree();
            DatabaseImpl db = dbTree.getDb(locker,
                                           mappingDbName,
View Full Code Here


    /**
     * Mappings are flushed to disk at close, and at checkpoints.
     */
    public void flushToDatabase(Durability useDurability) {
      
        TransactionConfig config = new TransactionConfig();
        config.setDurability(useDurability);
        Txn txn = Txn.createLocalTxn(envImpl, config);
        boolean success = false;
        try {
            flushToDatabase(txn);
            txn.commit();
View Full Code Here

        storeConfig = (config != null) ?
            config.cloneConfig() :
            StoreConfig.DEFAULT;

        autoCommitTxnConfig = new TransactionConfig();
        autoCommitNoWaitTxnConfig = new TransactionConfig();
        autoCommitNoWaitTxnConfig.setNoWait(true);
        /* <!-- begin JE only --> */
        if (!storeConfig.getReplicated()) {
            final Durability envDurability = env.getConfig().getDurability();
            configForNonRepDb(autoCommitTxnConfig, envDurability);
View Full Code Here

    public void testIllegalTransactionConfig()
        throws DatabaseException, InterruptedException {

        openEnv(false);
        TransactionConfig config = new TransactionConfig();
        config.setSerializableIsolation(true);
        config.setReadUncommitted(true);
        try {
            Transaction txn = env.beginTransaction(null, config);
            txn.abort();
            fail();
        } catch (IllegalArgumentException expected) {
View Full Code Here

        DbTree dbTree = env.getDbMapTree();
        Locker autoTxn = null;
        boolean operationOk = false;
        try {
            /* This method is used during eviction -- don't recurse. */
            autoTxn = new AutoTxn(env, new TransactionConfig());
            DatabaseImpl db = dbTree.getDb
                (autoTxn, DbTree.UTILIZATION_DB_NAME, null,
                 false /* No eviction allowed. */);
            if (db == null) {
                if (env.isReadOnly()) {
View Full Code Here

                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

       
        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

                 * 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

        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

            /* 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

TOP

Related Classes of com.sleepycat.je.TransactionConfig

Copyright © 2018 www.massapicom. 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.