Package com.sleepycat.je

Examples of com.sleepycat.je.EnvironmentConfig


      transactional = cache.getTransactionManager() != null;

      try
      {
         /* Open the environment, creating it if it doesn't exist. */
         EnvironmentConfig envConfig = new EnvironmentConfig();
         envConfig.setAllowCreate(true);
         envConfig.setTransactional(true);
         envConfig.setLockTimeout(1000 * cache.getConfiguration().getLockAcquisitionTimeout()); // these are in nanos
         if (log.isTraceEnabled()) log.trace("Creating JE environment with home dir " + homeDir);
         env = new Environment(homeDir, envConfig);
         if (log.isDebugEnabled()) log.debug("Created JE environment " + env + " for cache loader " + this);
         /* Open cache and catalog databases. */
         openDatabases();
View Full Code Here


        /* Create a single replicator */
        Durability durability = new Durability(SyncPolicy.NO_SYNC,
                                               SyncPolicy.NO_SYNC,
                                               ReplicaAckPolicy.NONE);

        EnvironmentConfig envConfig = new EnvironmentConfig();
        envConfig.setAllowCreate(false);
        envConfig.setTransactional(true);
        envConfig.setDurability(durability);

        ReplicationConfig repConfig = new ReplicationConfig();
        repConfig.setConfigParam
            (ReplicationConfig.ENV_CONSISTENCY_TIMEOUT, "1 min");
        repConfig.setGroupName(groupName);
View Full Code Here

        if (helpers != null) {
            repConfig.setHelperHosts(helpers);
        }

        EnvironmentConfig envConfig = new EnvironmentConfig();
        envConfig.setTransactional(true);
        envConfig.setAllowCreate(createEnv);
        ReplicatedEnvironment repEnv =
            new ReplicatedEnvironment(envHome, repConfig, envConfig);
        RepNode repNode = RepInternal.getRepImpl(repEnv).getRepNode();

        System.err.println("Handle created:" + repEnv +
View Full Code Here

     *
     * @return the group as currently defined by the environment
     */
    public static RepGroupImpl getGroup(final File envDir) {

        EnvironmentConfig envConfig = new EnvironmentConfig();
        envConfig.setReadOnly(true);
        envConfig.setTransactional(true);
        envConfig.setAllowCreate(false);
        Environment env = new Environment(envDir, envConfig);
        DatabaseConfig dbConfig = new DatabaseConfig();
        dbConfig.setReadOnly(true);
        dbConfig.setTransactional(true);
        dbConfig.setAllowCreate(false);
View Full Code Here

        } catch (IllegalArgumentException e) {
            e.printStackTrace();
            printUsage("Host and Port pair for this node is illegal.");
        }

        envConfig = new EnvironmentConfig();
        envConfig.setAllowCreate(true);
        envConfig.setTransactional(true);

        repConfig = new ReplicationConfig();
        repConfig.setNodeName(nodeName);
View Full Code Here

    }

    private CurrentTransaction(Environment env) {
        envRef = new WeakReference<Environment>(env);
        try {
            EnvironmentConfig config = env.getConfig();
            txnMode = config.getTransactional();
            lockingMode = DbCompat.getInitializeLocking(config);
            if (txnMode || lockingMode) {
                writeLockMode = LockMode.RMW;
            } else {
                writeLockMode = LockMode.DEFAULT;
View Full Code Here

    public StoredClassCatalog(Database database)
        throws DatabaseException, IllegalArgumentException {

        db = database;
        DatabaseConfig dbConfig = db.getConfig();
        EnvironmentConfig envConfig = db.getEnvironment().getConfig();

        writeLockMode = (DbCompat.getInitializeLocking(envConfig) ||
                         envConfig.getTransactional()) ? LockMode.RMW
                                                       : LockMode.DEFAULT;
        cdbMode = DbCompat.getInitializeCDB(envConfig);
        txnMode = dbConfig.getTransactional();

        if (!DbCompat.isTypeBtree(dbConfig)) {
View Full Code Here

                ("Environment home cannot be null");
        }
        this.environmentHome = environmentHome;
        this.canConfigure = canConfigure;
        if (canConfigure) {
            openConfig = new EnvironmentConfig();
        }
    }
View Full Code Here

                attrList.add(OPEN_ATTR[i]);
            }

            /* Add attributes for an open, transactional environment. */
            try {
                EnvironmentConfig config = targetEnv.getConfig();
                if (config.getTransactional()) {
                    for (int i = 0; i < TRANSACTIONAL_ATTR.length; i++) {
                        attrList.add(TRANSACTIONAL_ATTR[i]);
                    }
                }
            } catch (DatabaseException ignore) {
View Full Code Here

                return new Boolean(openConfig.getTxnSerializableIsolation());
            } else {
                /* The rest are JE environment attributes. */
                if (targetEnv != null) {

                    EnvironmentConfig config = targetEnv.getConfig();

                    if (attributeName.equals(ATT_IS_READ_ONLY)) {
                        return new Boolean(config.getReadOnly());
                    } else if (attributeName.equals(ATT_IS_TRANSACTIONAL)) {
                        return new Boolean(config.getTransactional());
                    } else if (attributeName.equals(ATT_CACHE_SIZE)) {
                        return new Long(config.getCacheSize());
                    } else if (attributeName.equals(ATT_CACHE_PERCENT)) {
                        return new Integer(config.getCachePercent());
                    } else if (attributeName.equals(ATT_LOCK_TIMEOUT)) {
                        return new Long(config.getLockTimeout());
                    } else if (attributeName.equals(ATT_IS_SERIALIZABLE)) {
                        return new
                            Boolean(config.getTxnSerializableIsolation());
                    } else if (attributeName.equals(ATT_TXN_TIMEOUT)) {
                        return new Long(config.getTxnTimeout());
                    } else {
                        throw new AttributeNotFoundException
                            ("attribute " + attributeName + " is not valid.");
                    }
                }
View Full Code Here

TOP

Related Classes of com.sleepycat.je.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.