Tabnine Logo
SqlJetDb.runWithLock
Code IndexAdd Tabnine 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)

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

  • Creating JSON documents from java classes using gson
  • setScale (BigDecimal)
  • putExtra (Intent)
  • getContentResolver (Context)
  • InputStream (java.io)
    A readable source of bytes.Most clients will use input streams that read data from the file system (
  • SocketTimeoutException (java.net)
    This exception is thrown when a timeout expired on a socket read or accept operation.
  • Queue (java.util)
    A collection designed for holding elements prior to processing. Besides basic java.util.Collection o
  • Executors (java.util.concurrent)
    Factory and utility methods for Executor, ExecutorService, ScheduledExecutorService, ThreadFactory,
  • StringUtils (org.apache.commons.lang)
    Operations on java.lang.String that arenull safe. * IsEmpty/IsBlank - checks if a String contains
  • Location (org.springframework.beans.factory.parsing)
    Class that models an arbitrary location in a Resource.Typically used to track the location of proble
  • Top plugins for Android Studio
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now