Package com.sleepycat.je

Examples of com.sleepycat.je.DatabaseException


                                           boolean retainNonTxnLocks,
                                           boolean readCommittedIsolation)
        throws DatabaseException {

        if (userTxn != null && !dbIsTransactional) {
            throw new DatabaseException
                ("A Transaction cannot be used because the" +
                 " database was opened" +
                 " non-transactionally");
        }
View Full Code Here


       
        DatabaseImpl dbImpl = DbInternal.dbGetDatabaseImpl(dbHandle);
        if (!dbImpl.isTransactional() &&
            locker != null &&
            locker.isTransactional()) {
            throw new DatabaseException
                ("A Transaction cannot be used because the" +
                 " database was opened" +
                 " non-transactionally");
        }
View Full Code Here

            /*
             * Other IOExceptions, such as out of disk conditions, should
             * notify the application but leave the environment in workable
             * condition.
             */
            throw new DatabaseException(Tracer.getStackTrace(e), e);
        }

        /*
         * Finish up business outside of the log write latch critical section.
         */
 
View Full Code Here

                                                      entrySize);
            }

            /* Sanity check */
            if (entrySize != marshalledBuffer.limit()) {
                throw new DatabaseException(
                 "Logged item entrySize= " + entrySize +
                 " but marshalledSize=" + marshalledBuffer.limit() +
                 " type=" + entryType + " currentLsn=" +
                 DbLsn.getNoFormatString(currentLsn));
            }
                                           
            /*
             * Ask for a log buffer suitable for holding this new entry.  If
             * the current log buffer is full, or if we flipped into a new
             * file, write it to disk and get a new, empty log buffer to
             * use. The returned buffer will be latched for write.
             */
            ByteBuffer useBuffer =
                logBufferPool.getWriteBuffer(entrySize, flippedFile);

            /* Add checksum to entry. */
            marshalledBuffer =
                addPrevOffsetAndChecksum(marshalledBuffer,
                                         fileManager.getPrevEntryOffset(),
                                         entrySize);

      /*
       * If the LogBufferPool buffer (useBuffer) doesn't have sufficient
       * space (since they're fixed size), just use the temporary buffer
       * and throw it away when we're done.  That way we don't grow the
       * LogBuffers in the pool permanently.  We risk an OOME on this
       * temporary usage, but we'll risk it.  [#12674]
       */
      if ((useBuffer.capacity() - useBuffer.position()) < entrySize) {
    fileManager.writeLogBuffer
        (new LogBuffer(marshalledBuffer, currentLsn));
    usedTemporaryBuffer = true;
    assert useBuffer.position() == 0;
    nTempBufferWrites++;
      } else {
    /* Copy marshalled object into write buffer. */
    useBuffer.put(marshalledBuffer);
      }
        } catch (Exception e) {

            /*
             * The LSN pointer, log buffer position, and corresponding file
             * position march in lockstep.
       *
             * 1. We bump the LSN.
             * 2. We copy loggable item into the log buffer.
             * 3. We may try to write the log buffer.
             *
             * If we've failed to put the item into the log buffer (2), we need
             * to restore old LSN state so that the log buffer doesn't have a
             * hole. [SR #12638] If we fail after (2), we don't need to restore
             * state, because log buffers will still match file positions.
             */
            fileManager.restoreLastPosition();
            if (e instanceof DatabaseException) {
                throw (DatabaseException) e;
            } else if (e instanceof IOException){
                throw (IOException) e;
            } else {
                throw new DatabaseException(e);
            }
        }
       
  /*
   * Tell the log buffer pool that we finished the write.  Record the
View Full Code Here

            throw new RunRecoveryException(envImpl,
                                           "Channel closed, may be "+
                                           "due to thread interrupt",
                                           e);
        } catch (Exception e) {
            throw new DatabaseException(e);
        } finally {
            if (logSource != null) {
                logSource.release();
            }
        }
View Full Code Here

    private String getEnvironmentMapKey(File file)
        throws DatabaseException {
        try {
            return file.getCanonicalPath();
        } catch (IOException e) {
            throw new DatabaseException(e);
        }
    }
View Full Code Here

  throws DatabaseException {

  try {
      return toString().getBytes("UTF-8");
  } catch (UnsupportedEncodingException UEE) {
      throw new DatabaseException(UEE);
  }
    }
View Full Code Here

        DatabaseConfig dbConfig = new DatabaseConfig();
        dbConfig.setAllowCreate(true);
        dbConfig.setSortedDuplicates(duplicatesAllowed);
        dbConfig.setTransactional(true);
        if (dbs[dbCnt] != null) {
      throw new DatabaseException("database already open");
        }
        Database db =
      env.openDatabase(txn, databaseName, dbConfig);
        dbs[dbCnt] = db;
        db.put(txn, key, data);
View Full Code Here

      DatabaseConfig dbConfig = new DatabaseConfig();
      dbConfig.setAllowCreate(create);
      dbConfig.setSortedDuplicates(duplicatesAllowed);
      dbConfig.setTransactional(transactional);
      if (dbs[dbCnt] != null) {
    throw new DatabaseException("database already open");
      }
      dbs[dbCnt] = env.openDatabase(txn, databaseName, dbConfig);
  }
    }
View Full Code Here

      DbScavenger scavenger =
                new DbScavenger(env, null, printable, aggressive,
                                false /* verbose */);
      scavenger.dump();
  } catch (IOException IOE) {
      throw new DatabaseException(IOE);
  }
    }
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.