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();
}
}
}
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);
}
}
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);
}
}
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();
}
}
}
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;
}
}
}
Aggregations