All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.mapdb.DBException.kt Maven / Gradle / Ivy

Go to download

MapDB provides concurrent Maps, Sets and Queues backed by disk storage or off-heap memory. It is a fast, scalable and easy to use embedded Java database.

There is a newer version: 3.1.0
Show newest version
package org.mapdb

import java.io.IOException
import java.nio.file.Path

/**
 * Exception hieroarchy for MapDB
 */
open class DBException(message: String?, cause: Throwable?) : RuntimeException(message, cause) {

    class NotSorted():DBException("Keys are not sorted")

    class WrongConfiguration(message: String) : DBException(message) {}

    constructor(message: String):this(message, null)


    class OutOfMemory(e: Throwable) : VolumeIOError(
            if ("Direct buffer memory" == e.message)
                "Out of Direct buffer memory. Increase it with JVM option '-XX:MaxDirectMemorySize=10G'"
            else
                e.message, e)


    class GetVoid(recid:Long): DBException("Record does not exist, recid="+recid);

    class WrongFormat(msg: String) : DBException(msg);
    class Interrupted(e:InterruptedException) : DBException("One of threads was interrupted while accessing store", e);
    open class DataCorruption(msg: String) : DBException(msg);


    class NewMapDBFormat(message:String =
                         "Store uses feature from newer version of MapDB, this MapDB version is old does not support new feature")
            :DBException(message){
    }

    class PointerChecksumBroken():DataCorruption("Broken bit parity")

    class FileLocked(path: Path, exception: Exception):
            DBException("File is already opened and is locked: "+path, exception)


    open class VolumeClosed(msg:String?, e: Throwable?) : DBException(msg, e){
        constructor(e: Throwable):this(null, e)
        constructor(msg: String):this(msg,null)
    }

    open class VolumeClosedByInterrupt(e: Throwable?) : DBException("Thread was interrupted during IO, FileChannel closed in result", e){
    }

    open class VolumeIOError(msg:String?, e: Throwable?) : DBException(msg, e){
        constructor(e: IOException):this(null, e)
        constructor(msg: String):this(msg, null)
    }

    open class VolumeEOF(msg:String?, e: IOException?) : VolumeIOError(msg, e){
        constructor(e: IOException):this(null, e)
        constructor(msg: String):this(msg,null)
    }


    class VolumeMaxSizeExceeded(length: Long, requestedLength: Long) :
            DBException("Could not expand store. Maximal store size: $length, new requested size: $requestedLength")

    class SerializationError(e: Exception) : DBException(null, e);

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy