Package com.sleepycat.je

Examples of com.sleepycat.je.Environment


  }

  if (!cacheSize.equals("0")) {
      envConfig.setConfigParam("je.maxMemory", cacheSize);
  }
        env = new Environment(new File("."), envConfig);

        DatabaseConfig dbConfig = new DatabaseConfig();
        dbConfig.setAllowCreate(true);
        dbConfig.setSortedDuplicates(true);
  dbConfig.setTransactional(true);
View Full Code Here


            EnvironmentConfig envConfig = TestUtils.initEnvConfig();
            envConfig.setAllowCreate(true);
            envConfig.setConfigParam(
                     EnvironmentParams.LOG_ITERATOR_MAX_SIZE.getName(),
                                     bufferMaxSize);
            env = new Environment(envHome, envConfig);

            envImpl = DbInternal.envGetEnvironmentImpl(env);

            /* Make a log file */
            createLogFile(10, entrySize, entrySizeIncrement);
View Full Code Here

    public void testEmptyExtraFile()
        throws Throwable {
 
  EnvironmentConfig envConfig = TestUtils.initEnvConfig();
        envConfig.setAllowCreate(true);
        Environment env = new Environment(envHome, envConfig);

        try {
            /* Make an environment. */
            env.sync();

            /* Add an extra, 0 length file */
            EnvironmentImpl envImpl = DbInternal.envGetEnvironmentImpl(env);

            File newFile = new File(envHome, "00000001.jdb");
            newFile.createNewFile();

            INFileReader reader = new INFileReader(envImpl,
                                                   1000,
                                                   DbLsn.NULL_LSN,
               DbLsn.NULL_LSN,
                                                   false,
                                                   false,
                                                   DbLsn.NULL_LSN,
                                                   null);
            while (reader.readNextEntry()) {
            }

        } catch (Throwable t) {
            t.printStackTrace();
            throw t;
        } finally {
            env.close();
        }
    }
View Full Code Here

        }
        setExtraProperties();
  if (createXAEnv) {
      env = new XAEnvironment(envHome, envConfig);
  } else {
      env = new Environment(envHome, envConfig);
  }
    }
View Full Code Here

        verifyData(expectedData, numDbs);
  TestUtils.validateNodeMemUsage(DbInternal.envGetEnvironmentImpl(env),
                                      false)
        /* Run verify again. */
        DbInternal.envGetEnvironmentImpl(env).close(false);
        env = new Environment(envHome, getRecoveryConfig(readOnlyMode));
        EnvironmentImpl envImpl =
      DbInternal.envGetEnvironmentImpl(env);
        infoList.add(envImpl.getLastRecoveryInfo());
        verifyData(expectedData, numDbs);
        TestUtils.validateNodeMemUsage(envImpl, false);
View Full Code Here

        /* Open it again, which will run recovery. */
  if (createXAEnv) {
      env = new XAEnvironment(envHome, getRecoveryConfig(readOnlyMode));
  } else {
      env = new Environment(envHome, getRecoveryConfig(readOnlyMode));
  }
        TestUtils.validateNodeMemUsage(DbInternal.envGetEnvironmentImpl(env),
                                      false);

        infoList.add
View Full Code Here

            File file2 = new File("build/test/classes");

            /* Create an environment. */
            EnvironmentConfig envConfig = TestUtils.initEnvConfig();
            envConfig.setAllowCreate(true);
            Environment envA = new Environment(envHome, envConfig);

            /* Look in the environment pool with the relative path name. */
            DbEnvPool.EnvironmentImplInfo info =
                DbEnvPool.getInstance().getEnvironment
                    (file2, TestUtils.initEnvConfig());
            /* We should find this file in the pool. */
            assertEquals(false, info.firstHandle);
            envA.close();

        } catch (Throwable t) {
            /* Dump stack trace before trying to tear down. */
            t.printStackTrace();
            throw t;
View Full Code Here

    (EnvironmentParams.NODE_MAX.getName(), "6");
      envConfig.setConfigParam(EnvironmentParams.MAX_MEMORY.getName(),
             new Long(1 << 24).toString());
            envConfig.setTransactional(true);
            envConfig.setTxnNoSync(Boolean.getBoolean(TestUtils.NO_SYNC));
            env = new Environment(envHome, envConfig);

            /*
             * Dbs 0  - N1-1 shouldn't exist
             * Dbs N1 - N5 should exist
             */
            checkForNoDb(dbName1, 0, N1);
            checkForDb(dbName1, N1, N5);

            /* Remove some dbs, abort */
            txn = env.beginTransaction(null, null);
            for (int i = N2; i < N4; i++) {
                env.removeDatabase(txn, dbName1+i);
            }
            txn.abort();

            /* Remove some dbs, commit */
            txn = env.beginTransaction(null, null);
            for (int i = N3; i < N4; i++) {
                env.removeDatabase(txn, dbName1+i);
            }
            txn.commit();

            /*
             * Dbs 0 - N1-1  should not exist
             * Dbs N1 - N3-1 should exist
             * Dbs N3 - N4-1 should not exist
             * Dbs N4 - N5-1 should exist
             */
            checkForNoDb(dbName1, 0, N1);
            checkForDb(dbName1, N1, N3);
            checkForNoDb(dbName1, N3, N4);
            checkForDb(dbName1, N4, N5);

            /* Close and recover */
            env.close();
            env = new Environment(envHome, envConfig);

            /*
             * Dbs 0 - N1-1  should not exist
             * Dbs N1 - N3-1 should exist
             * Dbs N3 - N4-1 should not exist
View Full Code Here

        throws MBeanException {

        File environmentDirectory = new File(environmentHome);
        jeHelper = new JEMBeanHelper(environmentDirectory, false);

        Environment targetEnv = getEnvironmentIfOpen();
        try {
            resetMBeanInfo(targetEnv);
        } finally {
            closeEnvironment(targetEnv);
        }
View Full Code Here

    public Object getAttribute(String attributeName)
        throws AttributeNotFoundException,
               MBeanException {

      Object result = null;
        Environment targetEnv = getEnvironmentIfOpen();
        try {
            result =  jeHelper.getAttribute(targetEnv, attributeName);
            targetEnv = checkForMBeanReset(targetEnv);
        } finally {
            /* release resource. */
 
View Full Code Here

TOP

Related Classes of com.sleepycat.je.Environment

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.