Search in sources :

Example 1 with DatabaseException

use of com.sleepycat.je.DatabaseException in project sessdb by ppdai.

the class BdbBenchmark method destroyDb.

@Override
public void destroyDb() {
    if (bdb_ != null) {
        try {
            bdb_.close();
            env_.removeDatabase(null, BdbBenchmark.DATABASE_NAME);
            env_.close();
            FileUtil.deleteDirectory(new File(databaseDir_));
            bdb_ = null;
            env_ = null;
        } catch (DatabaseException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }
}
Also used : File(java.io.File) DatabaseException(com.sleepycat.je.DatabaseException)

Example 2 with DatabaseException

use of com.sleepycat.je.DatabaseException in project titan by thinkaurelius.

the class BerkeleyJETx method rollback.

@Override
public synchronized void rollback() throws BackendException {
    super.rollback();
    if (tx == null)
        return;
    if (log.isTraceEnabled())
        log.trace("{} rolled back", this.toString(), new TransactionClose(this.toString()));
    try {
        closeOpenIterators();
        tx.abort();
        tx = null;
    } catch (DatabaseException e) {
        throw new PermanentBackendException(e);
    }
}
Also used : PermanentBackendException(com.thinkaurelius.titan.diskstorage.PermanentBackendException) DatabaseException(com.sleepycat.je.DatabaseException)

Example 3 with DatabaseException

use of com.sleepycat.je.DatabaseException in project titan by thinkaurelius.

the class BerkeleyJETx method commit.

@Override
public synchronized void commit() throws BackendException {
    super.commit();
    if (tx == null)
        return;
    if (log.isTraceEnabled())
        log.trace("{} committed", this.toString(), new TransactionClose(this.toString()));
    try {
        closeOpenIterators();
        tx.commit();
        tx = null;
    } catch (DatabaseException e) {
        throw new PermanentBackendException(e);
    }
}
Also used : PermanentBackendException(com.thinkaurelius.titan.diskstorage.PermanentBackendException) DatabaseException(com.sleepycat.je.DatabaseException)

Example 4 with DatabaseException

use of com.sleepycat.je.DatabaseException in project crawler4j by yasserg.

the class Frontier method scheduleAll.

public void scheduleAll(List<WebURL> urls) {
    int maxPagesToFetch = config.getMaxPagesToFetch();
    synchronized (mutex) {
        int newScheduledPage = 0;
        for (WebURL url : urls) {
            if ((maxPagesToFetch > 0) && ((scheduledPages + newScheduledPage) >= maxPagesToFetch)) {
                break;
            }
            try {
                workQueues.put(url);
                newScheduledPage++;
            } catch (DatabaseException e) {
                logger.error("Error while putting the url in the work queue", e);
            }
        }
        if (newScheduledPage > 0) {
            scheduledPages += newScheduledPage;
            counters.increment(Counters.ReservedCounterNames.SCHEDULED_PAGES, newScheduledPage);
        }
        synchronized (waitingList) {
            waitingList.notifyAll();
        }
    }
}
Also used : WebURL(edu.uci.ics.crawler4j.url.WebURL) DatabaseException(com.sleepycat.je.DatabaseException)

Example 5 with DatabaseException

use of com.sleepycat.je.DatabaseException in project crawler4j by yasserg.

the class Frontier method getNextURLs.

public void getNextURLs(int max, List<WebURL> result) {
    while (true) {
        synchronized (mutex) {
            if (isFinished) {
                return;
            }
            try {
                List<WebURL> curResults = workQueues.get(max);
                workQueues.delete(curResults.size());
                if (inProcessPages != null) {
                    for (WebURL curPage : curResults) {
                        inProcessPages.put(curPage);
                    }
                }
                result.addAll(curResults);
            } catch (DatabaseException e) {
                logger.error("Error while getting next urls", e);
            }
            if (result.size() > 0) {
                return;
            }
        }
        try {
            synchronized (waitingList) {
                waitingList.wait();
            }
        } catch (InterruptedException ignored) {
        // Do nothing
        }
        if (isFinished) {
            return;
        }
    }
}
Also used : WebURL(edu.uci.ics.crawler4j.url.WebURL) DatabaseException(com.sleepycat.je.DatabaseException)

Aggregations

DatabaseException (com.sleepycat.je.DatabaseException)17 DatabaseEntry (com.sleepycat.je.DatabaseEntry)5 Environment (com.sleepycat.je.Environment)5 OperationStatus (com.sleepycat.je.OperationStatus)5 Transaction (com.sleepycat.je.Transaction)5 VoldemortException (voldemort.VoldemortException)5 AsyncOperationStatus (voldemort.server.protocol.admin.AsyncOperationStatus)5 PersistenceFailureException (voldemort.store.PersistenceFailureException)5 Versioned (voldemort.versioning.Versioned)3 StatsConfig (com.sleepycat.je.StatsConfig)2 PermanentBackendException (com.thinkaurelius.titan.diskstorage.PermanentBackendException)2 WebURL (edu.uci.ics.crawler4j.url.WebURL)2 File (java.io.File)2 CheckpointConfig (com.sleepycat.je.CheckpointConfig)1 Database (com.sleepycat.je.Database)1 DatabaseConfig (com.sleepycat.je.DatabaseConfig)1 EnvironmentConfig (com.sleepycat.je.EnvironmentConfig)1 JmxOperation (voldemort.annotations.jmx.JmxOperation)1 StorageInitializationException (voldemort.store.StorageInitializationException)1 ObsoleteVersionException (voldemort.versioning.ObsoleteVersionException)1