Package com.sleepycat.db

Examples of com.sleepycat.db.EnvironmentConfig


    }

    public void testSubclassIndex()
        throws IOException, DatabaseException {

        EnvironmentConfig envConfig = TestEnv.BDB.getConfig();
        envConfig.setAllowCreate(true);
        env = new Environment(envHome, envConfig);

        StoreConfig storeConfig = new StoreConfig();
        storeConfig.setAllowCreate(true);
        EntityStore store = new EntityStore(env, "foo", storeConfig);
View Full Code Here


            SequenceEntity_tint_composite.class,
            SequenceEntity_tshort_composite.class,
            SequenceEntity_tbyte_composite.class,
        };

        EnvironmentConfig envConfig = TestEnv.BDB.getConfig();
        envConfig.setAllowCreate(true);
        env = new Environment(envHome, envConfig);

        StoreConfig storeConfig = new StoreConfig();
        storeConfig.setAllowCreate(true);
        EntityStore store = new EntityStore(env, "foo", storeConfig);
View Full Code Here

    private static void openEnv() throws DatabaseException {
        System.out.println("opening env");

        // Set up the environment.
        EnvironmentConfig myEnvConfig = new EnvironmentConfig();

        // Region files are not backed by the filesystem, they are
        // backed by heap memory.
        myEnvConfig.setPrivate(true);
        myEnvConfig.setAllowCreate(true);
        myEnvConfig.setInitializeCache(true);
        myEnvConfig.setInitializeLocking(true);
        myEnvConfig.setInitializeLogging(true);
        myEnvConfig.setThreaded(true);

        myEnvConfig.setTransactional(true);
        // EnvironmentConfig.setThreaded(true) is the default behavior
        // in Java, so we do not have to do anything to cause the
        // environment handle to be free-threaded.

        // Indicate that we want db to internally perform deadlock
        // detection. Also indicate that the transaction that has
        // performed the least amount of write activity to
        // receive the deadlock notification, if any.
        myEnvConfig.setLockDetectMode(LockDetectMode.MINWRITE);

        // Specify in-memory logging
        myEnvConfig.setLogInMemory(true);
        // Specify the size of the in-memory log buffer
        // Must be large enough to handle the log data created by
        // the largest transaction.
        myEnvConfig.setLogBufferSize(10 * 1024 * 1024);
        // Specify the size of the in-memory cache
        // Set it large enough so that it won't page.
        myEnvConfig.setCacheSize(10 * 1024 * 1024);

        // Set up the database
        DatabaseConfig myDbConfig = new DatabaseConfig();
        myDbConfig.setType(DatabaseType.BTREE);
        myDbConfig.setAllowCreate(true);
View Full Code Here

        throws DatabaseException, FileNotFoundException
    {
        TestOptions options = new TestOptions();
        options.db_config.setErrorPrefix("DatabaseTest::test4 ");

        EnvironmentConfig envc = new EnvironmentConfig();
        envc.setAllowCreate(true);
        envc.setInitializeCache(true);
      options.db_env = new Environment(TestUtils.BASETEST_DBFILE, envc);

        rundb(itemcount++, options);
        options.db_env.close();
    }
View Full Code Here

        throws DatabaseException, FileNotFoundException
    {
        TestOptions options = new TestOptions();
        options.db_config.setErrorPrefix("DatabaseTest::test5 ");

        EnvironmentConfig envc = new EnvironmentConfig();
        envc.setAllowCreate(true);
        envc.setInitializeCache(true);
      options.db_env = new Environment(TestUtils.BASETEST_DBFILE, envc);

        rundb(itemcount++, options);

        rundb(itemcount++, options);
View Full Code Here

        TestOptions options = new TestOptions();
        options.db_config.setErrorPrefix("DatabaseTest::test6 ");

        Database db = new Database(TestUtils.getDBFileName(DATABASETEST_DBNAME), null, options.db_config);

        EnvironmentConfig envc = new EnvironmentConfig();
        envc.setAllowCreate(true);
        envc.setInitializeCache(true);
      Environment db_env = new Environment(TestUtils.BASETEST_DBFILE, envc);

      db.close();
      db_env.close();
View Full Code Here

      itemcount = 0;
        TestOptions options = new TestOptions();
        options.save_db = true;
        options.db_config.setErrorPrefix("DatabaseTest::test8 ");

        EnvironmentConfig envc = new EnvironmentConfig();
        envc.setAllowCreate(true);
        envc.setInitializeCache(true);
      options.db_env = new Environment(TestUtils.BASETEST_DBFILE, envc);

        // stop rundb from closing the database, and pass in one created.
      rundb(itemcount++, options);
      rundb(itemcount++, options);
View Full Code Here

                if (name.startsWith("__") || name.startsWith("log."))
                    files[i].delete();
            }
        }

        EnvironmentConfig envConfig = new EnvironmentConfig();
        DatabaseConfig dbConfig = new DatabaseConfig();

        envConfig.setTransactional(true);
        envConfig.setInitializeCache(true);
        envConfig.setInitializeLocking(true);
        envConfig.setInitializeLogging(true);
        envConfig.setAllowCreate(true);
        envConfig.setThreaded(true);
        dbConfig.setAllowCreate(true);
        dbConfig.setType(DatabaseType.BTREE);

        env = new Environment(dbHome, envConfig);
View Full Code Here

      defaultTxnConfig.setReadCommitted(false);
      break;
  default:
      throw new AssertionError();
  }
  EnvironmentConfig config = new EnvironmentConfig();
  config.setAllowCreate(true);
  config.setCacheSize(cacheSize);
  config.setErrorHandler(new LoggingErrorHandler());
  config.setInitializeCache(true);
  config.setInitializeLocking(true);
  config.setInitializeLogging(true);
  config.setLockDetectMode(LockDetectMode.YOUNGEST);
  config.setLockTimeout(lockTimeoutMicros);
  config.setLogAutoRemove(removeLogs);
  config.setMessageHandler(new LoggingMessageHandler());
  config.setRunRecovery(true);
  config.setTransactional(true);
  config.setTxnWriteNoSync(!flushToDisk);
  try {
      env = new Environment(new File(directory), config);
  } catch (FileNotFoundException e) {
      throw new DbDatabaseException(
    "DataStore directory does not exist: " + directory);
View Full Code Here

* For use in the build.xml of this contrib, to determine if tests
* should be skipped.
*/
public class SanityLoadLibrary {
  public static void main(String[] ignored) throws Exception {
    EnvironmentConfig envConfig = EnvironmentConfig.DEFAULT;
    envConfig.setAllowCreate(false);
    Environment env = new Environment(null, envConfig);
  }
View Full Code Here

TOP

Related Classes of com.sleepycat.db.EnvironmentConfig

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.