Codota Logo
SqlJetDb.runWithLock
Code IndexAdd Codota to your IDE (free)

How to use
runWithLock
method
in
org.tmatesoft.sqljet.core.table.SqlJetDb

Best Java code snippets using org.tmatesoft.sqljet.core.table.SqlJetDb.runWithLock (Showing top 11 results out of 315)

  • Common ways to obtain SqlJetDb
private void myMethod () {
SqlJetDb s =
  • Codota IconFile file;SqlJetDb.open(file, true)
  • Codota IconFSFS fSFS;SqlJetDb.open(fSFS.getRepositoryCacheFile(), true)
  • Smart code suggestions by Codota
}
origin: org.tmatesoft.sqljet/sqljet

public ISqlJetCursor open() throws SqlJetException {
  return (ISqlJetCursor) db.runWithLock(new ISqlJetRunnableWithLock() {
    public Object runWithLock(SqlJetDb db) throws SqlJetException {
      return new SqlJetTableDataCursor(new SqlJetBtreeDataTable(btree, tableName, write), db);
    }
  });
}
origin: org.tmatesoft.sqljet/sqljet

public ISqlJetCursor order(final String indexName) throws SqlJetException {
  return (ISqlJetCursor) db.runWithLock(new ISqlJetRunnableWithLock() {
    public Object runWithLock(SqlJetDb db) throws SqlJetException {
      final SqlJetBtreeDataTable table = new SqlJetBtreeDataTable(btree, tableName, write);
      checkIndexName(indexName, table);
      return new SqlJetIndexOrderCursor(table, db, indexName);
    }
  });
}
origin: com.svnkit/com.springsource.org.tigris.subversion.javahl

private static void checkFormat(final SqlJetDb db) throws SqlJetException {
  db.runWithLock(new ISqlJetRunnableWithLock() {
    public Object runWithLock(SqlJetDb db) throws SqlJetException {
      int version = db.getOptions().getUserVersion();
      if (version < REP_CACHE_DB_FORMAT) {
        db.getOptions().setAutovacuum(true);
        db.runWriteTransaction(new ISqlJetTransaction() {
          public Object run(SqlJetDb db) throws SqlJetException {
            db.getOptions().setUserVersion(REP_CACHE_DB_FORMAT);
            db.createTable(FSRepresentationCacheManager.REP_CACHE_DB_SQL);
            return null;
          }
        });
      } else if (version > REP_CACHE_DB_FORMAT) {
        throw new SqlJetException("Schema format " + version + " not recognized");   
      }
      return null;
    }
  });
}

origin: org.tmatesoft.sqljet/sqljet

public void exec(final String sql, final SqlJetExecCallback callback) throws SqlJetException {
  db.runWithLock(new ISqlJetRunnableWithLock() {
    public Object runWithLock(SqlJetDb db) throws SqlJetException {
      SqlJetPreparedStatement stmt = prepare(sql);
      try {
        while (stmt.step()) {
          if (callback != null) {
            callback.processRow(stmt);
          }
        }
      } finally {
        stmt.close();
      }
      return null;
    }
  });
}
origin: org.jvnet.hudson.svnkit/svnkit

private static void checkFormat(final SqlJetDb db) throws SqlJetException {
  db.runWithLock(new ISqlJetRunnableWithLock() {
    public Object runWithLock(SqlJetDb db) throws SqlJetException {
      int version = db.getOptions().getUserVersion();
      if (version < REP_CACHE_DB_FORMAT) {
        db.getOptions().setAutovacuum(true);
        db.runWriteTransaction(new ISqlJetTransaction() {
          public Object run(SqlJetDb db) throws SqlJetException {
            db.getOptions().setUserVersion(REP_CACHE_DB_FORMAT);
            db.createTable(FSRepresentationCacheManager.REP_CACHE_DB_SQL);
            return null;
          }
        });
      } else if (version > REP_CACHE_DB_FORMAT) {
        throw new SqlJetException("Schema format " + version + " not recognized");   
      }
      return null;
    }
  });
}

origin: org.tmatesoft.svnkit/svnkit

private static void checkFormat(final SqlJetDb db) throws SqlJetException {
  db.runWithLock(new ISqlJetRunnableWithLock() {
    public Object runWithLock(SqlJetDb db) throws SqlJetException {
      int version = db.getOptions().getUserVersion();
      if (version < REP_CACHE_DB_FORMAT) {
        db.getOptions().setAutovacuum(true);
        db.runWriteTransaction(new ISqlJetTransaction() {
          public Object run(SqlJetDb db) throws SqlJetException {
            db.getOptions().setUserVersion(REP_CACHE_DB_FORMAT);
            db.createTable(FSRepresentationCacheManager.REP_CACHE_DB_SQL);
            return null;
          }
        });
      } else if (version > REP_CACHE_DB_FORMAT) {
        throw new SqlJetException("Schema format " + version + " not recognized");   
      }
      return null;
    }
  });
}

origin: org.tmatesoft.sqljet/sqljet

public ISqlJetCursor lookup(final String indexName, final Object... key) throws SqlJetException {
  final Object[] k = SqlJetUtility.adjustNumberTypes(key);
  return (ISqlJetCursor) db.runWithLock(new ISqlJetRunnableWithLock() {
    public Object runWithLock(SqlJetDb db) throws SqlJetException {
      final SqlJetBtreeDataTable table = new SqlJetBtreeDataTable(btree, tableName, write);
      checkIndexName(indexName, table);
      return new SqlJetIndexScopeCursor(table, db, indexName, k, k);
    }
  });
}
origin: org.tmatesoft.sqljet/sqljet

public ISqlJetCursor scope(final String indexName, SqlJetScope scope)  throws SqlJetException {
  final SqlJetScope adjustedScope = SqlJetUtility.adjustScopeNumberTypes(scope);
  return (ISqlJetCursor) db.runWithLock(new ISqlJetRunnableWithLock() {
    public Object runWithLock(SqlJetDb db) throws SqlJetException {
      final SqlJetBtreeDataTable table = new SqlJetBtreeDataTable(btree, tableName, write);
      checkIndexName(indexName, table);
      if (isNeedReverse(getIndexTable(indexName, table), adjustedScope)) {
        return new SqlJetReverseOrderCursor(new SqlJetIndexScopeCursor(table, db, indexName, adjustedScope.reverse()));
      } else {
        return new SqlJetIndexScopeCursor(table, db, indexName, adjustedScope);
      }
    }
  });
}
origin: org.tmatesoft.sqljet/sqljet

return (SqlJetDb) runWithLock(new ISqlJetRunnableWithLock() {
  public Object runWithLock(SqlJetDb db) throws SqlJetException {
    if (temporaryDb == null || !temporaryDb.isOpen()) {
origin: org.tmatesoft.sqljet/sqljet

/**
 * Executes pragma statement. If statement queries pragma value then pragma
 * value will be returned.
 */
public Object pragma(final String sql) throws SqlJetException {
  checkOpen();
  refreshSchema();
  return runWithLock(new ISqlJetRunnableWithLock() {
    public Object runWithLock(SqlJetDb db) throws SqlJetException {
      return new SqlJetPragmasHandler(getOptions()).pragma(sql);
    }
  });
}
origin: org.tmatesoft.sqljet/sqljet

/**
 * Open table.
 * 
 * @param tableName name of the table to open.
 * @return opened table
 */
public ISqlJetTable getTable(final String tableName) throws SqlJetException {
  checkOpen();
  refreshSchema();
  return (SqlJetTable) runWithLock(new ISqlJetRunnableWithLock() {
    public Object runWithLock(SqlJetDb db) throws SqlJetException {
      return new SqlJetTable(db, btree, tableName, writable);
    }
  });
}
org.tmatesoft.sqljet.core.tableSqlJetDbrunWithLock

Javadoc

Do some actions with locking database's internal threads synchronization mutex. It is related only with synchronization of access to one connection from multiple threads. It is not related with transactions and locks of database file. For concurrent access to database from threads or processes use transactions.

Popular methods of SqlJetDb

  • getTable
    Open table.
  • open
  • close
  • getOptions
  • createIndex
    Create index from SQL clause.
  • createTable
    Create table from SQL clause.
  • runWriteTransaction
    Run modifications in write transaction.
  • beginTransaction
  • commit
  • getSchema
    Get database schema.
  • runReadTransaction
    Run read-only transaction.
  • dropIndex
    Drop index.
  • runReadTransaction,
  • dropIndex,
  • dropTable,
  • getTemporaryDatabase,
  • isInTransaction,
  • isOpen,
  • rollback,
  • <init>,
  • alterTable

Popular in Java

  • Start an intent from android
  • onCreateOptionsMenu (Activity)
  • getResourceAsStream (ClassLoader)
  • orElseThrow (Optional)
  • VirtualMachine (com.sun.tools.attach)
    A Java virtual machine. A VirtualMachine represents a Java virtual machine to which this Java vir
  • EOFException (java.io)
    Thrown when a program encounters the end of a file or stream during an input operation.
  • MessageDigest (java.security)
    Uses a one-way hash function to turn an arbitrary number of bytes into a fixed-length byte sequence.
  • ReentrantLock (java.util.concurrent.locks)
    A reentrant mutual exclusion Lock with the same basic behavior and semantics as the implicit monitor
  • SSLHandshakeException (javax.net.ssl)
    The exception that is thrown when a handshake could not be completed successfully.
  • Response (javax.ws.rs.core)
    Defines the contract between a returned instance and the runtime when an application needs to provid
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now