Java Code Examples for com.sleepycat.je.LockMode#DEFAULT

The following examples show how to use com.sleepycat.je.LockMode#DEFAULT . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: JE_Table.java    From tddl5 with Apache License 2.0 5 votes vote down vote up
public ISchematicCursor getCursor(ITransaction txn, IndexMeta indexMeta, String isolation, String actualTableName)
                                                                                                                  throws TddlException {
    Database db = getDatabase(actualTableName);
    if (db == null) {
        throw new IllegalArgumentException("table don't contains indexName:" + actualTableName);
    }
    CursorConfig cc = CursorConfig.DEFAULT;
    LockMode lm = LockMode.DEFAULT;
    if (txn != null) {
        com.sleepycat.je.TransactionConfig _config = ((JE_Transaction) txn).config;
        if (_config.getReadUncommitted()) {
            cc = CursorConfig.READ_UNCOMMITTED;
            lm = LockMode.READ_UNCOMMITTED;
        } else if (_config.getReadCommitted()) {
            cc = CursorConfig.READ_COMMITTED;
            // lm = LockMode.READ_COMMITTED;
        }
    } else {
        if (Isolation.READ_COMMITTED.equals(isolation)) {
            cc = CursorConfig.READ_COMMITTED;
            // lm = LockMode.READ_COMMITTED;//not support
        } else if (Isolation.READ_UNCOMMITTED.equals(isolation)) {
            cc = CursorConfig.READ_UNCOMMITTED;
            lm = LockMode.READ_UNCOMMITTED;
        } else if (Isolation.REPEATABLE_READ.equals(isolation)) {
            // default
        } else if (Isolation.SERIALIZABLE.equals(isolation)) {
            // txn_config
        }
    }
    JE_Cursor je_cursor = new JE_Cursor(indexMeta, db.openCursor(txn == null ? null : ((JE_Transaction) txn).txn,
        cc), lm);
    if (txn != null) {
        ((JE_Transaction) txn).addCursor(je_cursor);
    }
    return new SchematicCursor(je_cursor, je_cursor.getiCursorMeta(), ExecUtils.getOrderBy(indexMeta));
}
 
Example 2
Source File: JE_Table.java    From tddl5 with Apache License 2.0 5 votes vote down vote up
@Override
public ISchematicCursor getCursor(ExecutionContext executionContext, IndexMeta indexMeta, String actualTableName)
                                                                                                                 throws TddlException {
    Database db = getDatabase(actualTableName);
    if (db == null) {
        throw new IllegalArgumentException("table don't contains indexName:" + actualTableName);
    }
    ITransaction txn = executionContext.getTransaction();
    CursorConfig cc = CursorConfig.DEFAULT;
    LockMode lm = LockMode.DEFAULT;
    if (txn != null) {
        com.sleepycat.je.TransactionConfig _config = ((JE_Transaction) txn).config;
        if (_config.getReadUncommitted()) {
            cc = CursorConfig.READ_UNCOMMITTED;
            lm = LockMode.READ_UNCOMMITTED;
        } else if (_config.getReadCommitted()) {
            cc = CursorConfig.READ_COMMITTED;
            // lm = LockMode.READ_COMMITTED;
        }
    } else {

        cc = CursorConfig.READ_COMMITTED;

    }
    JE_Cursor je_cursor = new JE_Cursor(indexMeta, db.openCursor(txn == null ? null : ((JE_Transaction) txn).txn,
        cc), lm);
    if (txn != null) {
        ((JE_Transaction) txn).addCursor(je_cursor);
    }
    return new SchematicCursor(je_cursor, je_cursor.getiCursorMeta(), ExecUtils.getOrderBy(indexMeta));
}
 
Example 3
Source File: JE_Table.java    From tddl with Apache License 2.0 5 votes vote down vote up
public ISchematicCursor getCursor(ITransaction txn, IndexMeta indexMeta, String isolation, String actualTableName)
                                                                                                                  throws TddlException {
    Database db = getDatabase(actualTableName);
    if (db == null) {
        throw new TddlException("table don't contains indexName:" + actualTableName);
    }
    CursorConfig cc = CursorConfig.DEFAULT;
    LockMode lm = LockMode.DEFAULT;
    if (txn != null) {
        com.sleepycat.je.TransactionConfig _config = ((JE_Transaction) txn).config;
        if (_config.getReadUncommitted()) {
            cc = CursorConfig.READ_UNCOMMITTED;
            lm = LockMode.READ_UNCOMMITTED;
        } else if (_config.getReadCommitted()) {
            cc = CursorConfig.READ_COMMITTED;
            // lm = LockMode.READ_COMMITTED;
        }
    } else {
        if (Isolation.READ_COMMITTED.equals(isolation)) {
            cc = CursorConfig.READ_COMMITTED;
            // lm = LockMode.READ_COMMITTED;//not support
        } else if (Isolation.READ_UNCOMMITTED.equals(isolation)) {
            cc = CursorConfig.READ_UNCOMMITTED;
            lm = LockMode.READ_UNCOMMITTED;
        } else if (Isolation.REPEATABLE_READ.equals(isolation)) {
            // default
        } else if (Isolation.SERIALIZABLE.equals(isolation)) {
            // txn_config
        }
    }
    JE_Cursor je_cursor = new JE_Cursor(indexMeta,

    db.openCursor(txn == null ? null : ((JE_Transaction) txn).txn, cc), lm);
    if (txn != null) {
        ((JE_Transaction) txn).addCursor(je_cursor);
    }
    return new SchematicCursor(je_cursor, je_cursor.getiCursorMeta(), ExecUtils.getOrderBy(indexMeta));
}
 
Example 4
Source File: JE_Table.java    From tddl with Apache License 2.0 5 votes vote down vote up
@Override
public ISchematicCursor getCursor(ExecutionContext executionContext, IndexMeta indexMeta, String actualTableName)
                                                                                                                 throws TddlException {
    Database db = getDatabase(actualTableName);
    if (db == null) {
        throw new TddlException("table don't contains indexName:" + actualTableName);
    }
    ITransaction txn = executionContext.getTransaction();
    CursorConfig cc = CursorConfig.DEFAULT;
    LockMode lm = LockMode.DEFAULT;
    if (txn != null) {
        com.sleepycat.je.TransactionConfig _config = ((JE_Transaction) txn).config;
        if (_config.getReadUncommitted()) {
            cc = CursorConfig.READ_UNCOMMITTED;
            lm = LockMode.READ_UNCOMMITTED;
        } else if (_config.getReadCommitted()) {
            cc = CursorConfig.READ_COMMITTED;
            // lm = LockMode.READ_COMMITTED;
        }
    } else {

        cc = CursorConfig.READ_COMMITTED;

    }
    JE_Cursor je_cursor = new JE_Cursor(indexMeta,

    db.openCursor(txn == null ? null : ((JE_Transaction) txn).txn, cc), lm);
    if (txn != null) {
        ((JE_Transaction) txn).addCursor(je_cursor);
    }
    return new SchematicCursor(je_cursor, je_cursor.getiCursorMeta(), ExecUtils.getOrderBy(indexMeta));
}