Package com.sleepycat.je

Examples of com.sleepycat.je.DatabaseException


        Level level = null;
        try {
            String levelVal = envImpl.getConfigManager().get(configParam);
            level = Level.parse(levelVal);
        } catch (IllegalArgumentException e) {
            throw new DatabaseException("Problem parsing parameter " +
          configParam.getName() +
          ": " + e.getMessage(), e);
        }
        return level;
    }
View Full Code Here


            isReadOnly =
    configManager.getBoolean(EnvironmentParams.ENV_RDONLY);
            fileManager = new FileManager(this, envHome, isReadOnly);
            if (!envConfig.getAllowCreate() && !fileManager.filesExist()) {
                throw new DatabaseException
        ("Enviroment creation isn't allowed, " +
         " but there is no pre-existing " +
         " environment in " + envHome);
            }

            if (getConfigManager().
                getBoolean(EnvironmentParams.ENV_FAIR_LATCHES)) {
                logManager = new LatchedLogManager(this, isReadOnly);
            } else {
                logManager = new SyncedLogManager(this, isReadOnly);
            }

            inMemoryINs = new INList(this);
            txnManager = new TxnManager(this);

            /*
             * Create the file utilization objects before creating the Cleaner
             * or running recovery.
             */
            utilizationTracker = new UtilizationTracker(this);
            utilizationProfile =
    new UtilizationProfile(this, utilizationTracker);

            /*
             * Daemons are always made here, but only started after recovery.
             * We want them to exist so we can call them programatically even
             * if the daemon thread is not started.
             */
            createDaemons();

            /*
       * Recovery will recreate the dbMapTree from the log if it exists.
       */
            dbMapTree = new DbTree(this);

            referenceCount = 0;

            triggerLatch = new SharedLatch(this, "TriggerLatch", this);

            /*
             * Do not do recovery and start daemons if this environment is for
             * a utility.
             */
            if (configManager.getBoolean(EnvironmentParams.ENV_RECOVERY)) {

                /*
                 * Run recovery.  Note that debug logging to the database log
                 * is disabled until recovery is finished.
                 */
                try {
                    RecoveryManager recoveryManager =
      new RecoveryManager(this);
                    lastRecoveryInfo = recoveryManager.recover(isReadOnly);
                } finally {
                    try {
                        /* Flush to get all exception tracing out to the log.*/
                        logManager.flush();
                        fileManager.clear();
                    } catch (IOException e) {
                        throw new DatabaseException(e.getMessage());
                    }
                }
            } else {
                isReadOnly = true;
    noComparators = true;
View Full Code Here

                fileHandler.setFormatter(new SimpleFormatter());
                fileHandler.setLevel(level);
                logger.addHandler(fileHandler);
            }
        } catch (IOException e) {
            throw new DatabaseException(e.getMessage());
        }

        return logger;
    }
View Full Code Here

    public void checkNotClosed()
        throws DatabaseException {

        if (envState == DbEnvState.CLOSED) {
            throw new DatabaseException
                ("Attempt to use a Environment that has been closed.");
        }
    }
View Full Code Here

     */
    public Txn txnBegin(Transaction parent, TransactionConfig txnConfig)
        throws DatabaseException {

        if (!isTransactional) {
            throw new DatabaseException("beginTransaction called, " +
                                        " but Environment was not opened "+
                                        "with transactional cpabilities");
        }

        return txnManager.txnBegin(parent, txnConfig);
View Full Code Here

                transitionOk = true;
                break;
            }
        }
        if (!transitionOk) {
            throw new DatabaseException("Can't go from environment state " +
          toString() +
          " to " +
          newState.toString());
        }
    }
View Full Code Here

      if (ln instanceof NameLN) {
    String name = new String(lnEntry.getKey());
    Integer dbId = new Integer(((NameLN) ln).getId().getId());
    if (dbIdToName.containsKey(dbId) &&
        !((String) dbIdToName.get(dbId)).equals(name)) {
        throw new DatabaseException
      ("Already name mapped for dbId: " + dbId +
       " changed from " + (String) dbIdToName.get(dbId) +
       " to " + name);
    } else {
        dbIdToName.put(dbId, name);
    }
      }

      if (ln instanceof MapLN) {
    DatabaseImpl db = ((MapLN) ln).getDatabase();
    Integer dbId = new Integer(db.getId().getId());
    Boolean dupSort = Boolean.valueOf(db.getSortedDuplicates());
    if (dbIdToDupSort.containsKey(dbId)) {
        throw new DatabaseException
      ("Already saw dupSort entry for dbId: " + dbId);
    } else {
        dbIdToDupSort.put(dbId, dupSort);
    }
      }
View Full Code Here

    dupSort = Boolean.valueOf(false);
      }
      printHeader(ret, dupSort.booleanValue(), formatUsingPrintable);
      return ret;
  } catch (IOException IOE) {
      throw new DatabaseException(IOE);
  }
    }
View Full Code Here

                nodeId = LogUtils.readLong(entryBuffer);
                entryBuffer.position(endPosition);
                ln = null;
            }
        } catch (IllegalAccessException e) {
            throw new DatabaseException(e);
        } catch (InstantiationException e) {
            throw new DatabaseException(e);
        }
    }
View Full Code Here

    public int prepare(Xid xid)
  throws DatabaseException {

  if ((txnState & IS_PREPARED) != 0) {
      throw new DatabaseException
    ("prepare() has already been called for Transaction " +
     id + ".");
  }
  checkState(false);
  synchronized (this) {
      if (checkCursorsForClose()) {
    throw new DatabaseException
        ("Transaction " + id +
         " prepare failed because there were open cursors.");
      }

      TxnPrepare prepareRecord =
View Full Code Here

TOP

Related Classes of com.sleepycat.je.DatabaseException

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.