use of org.janusgraph.util.datastructures.ExceptionWrapper in project janusgraph by JanusGraph.
the class Backend method close.
public synchronized void close() throws BackendException {
if (!hasAttemptedClose) {
hasAttemptedClose = true;
ExceptionWrapper exceptionWrapper = new ExceptionWrapper();
executeWithCatching(managementLogManager::close, exceptionWrapper);
executeWithCatching(txLogManager::close, exceptionWrapper);
executeWithCatching(userLogManager::close, exceptionWrapper);
executeWithCatching(scanner::close, exceptionWrapper);
if (edgeStore != null)
executeWithCatching(edgeStore::close, exceptionWrapper);
if (indexStore != null)
executeWithCatching(indexStore::close, exceptionWrapper);
if (idAuthority != null)
executeWithCatching(idAuthority::close, exceptionWrapper);
if (systemConfig != null)
executeWithCatching(systemConfig::close, exceptionWrapper);
if (userConfig != null)
executeWithCatching(userConfig::close, exceptionWrapper);
executeWithCatching(storeManager::close, exceptionWrapper);
gracefulExecutorServiceShutdown(threadPool, threadPoolShutdownMaxWaitTime);
// Indexes
for (IndexProvider index : indexes.values()) {
executeWithCatching(index::close, exceptionWrapper);
}
throwIfException(exceptionWrapper);
} else {
log.debug("Backend {} has already been closed or cleared", this);
}
}
use of org.janusgraph.util.datastructures.ExceptionWrapper in project janusgraph by JanusGraph.
the class KCVSLog method close.
/**
* Closes the log by terminating all threads and waiting for their termination.
*
* @throws org.janusgraph.diskstorage.BackendException
*/
@Override
public synchronized void close() throws BackendException {
if (!isOpen)
return;
this.isOpen = false;
if (readExecutor != null)
readExecutor.shutdown();
if (sendThread != null)
sendThread.close(CLOSE_DOWN_WAIT);
if (readExecutor != null) {
try {
readExecutor.awaitTermination(1, TimeUnit.SECONDS);
} catch (InterruptedException e) {
log.error("Could not terminate reader thread pool for KCVSLog {} due to interruption", name, e);
}
if (!readExecutor.isTerminated()) {
readExecutor.shutdownNow();
log.error("Reader thread pool for KCVSLog {} did not shut down in time - could not clean up or set read markers", name);
} else {
for (MessagePuller puller : msgPullers) {
puller.close();
}
}
}
ExceptionWrapper exceptionWrapper = new ExceptionWrapper();
ExecuteUtil.executeWithCatching(() -> {
try {
writeSetting(manager.senderId, MESSAGE_COUNTER_COLUMN, numMsgCounter.get());
} catch (Throwable e) {
log.error("Could not persist message counter [{}] ; message counter [{}]", manager.senderId, numMsgCounter.get(), e);
throw e;
}
}, exceptionWrapper);
ExecuteUtil.executeWithCatching(() -> {
try {
store.close();
} catch (Throwable e) {
log.error("Could not correctly close store [{}]", store.getName(), e);
throw e;
}
}, exceptionWrapper);
ExecuteUtil.executeWithCatching(() -> {
try {
manager.closedLog(this);
} catch (Throwable e) {
log.error("Could not correctly close log [{}] and remove it from manager.", getName(), e);
throw e;
}
}, exceptionWrapper);
ExecuteUtil.throwIfException(exceptionWrapper);
}
use of org.janusgraph.util.datastructures.ExceptionWrapper in project janusgraph by JanusGraph.
the class StandardScanner method close.
public void close() throws BackendException {
// Interrupt running jobs
ExceptionWrapper exceptionWrapper = new ExceptionWrapper();
for (StandardScannerExecutor exe : runningJobs.values()) {
if (exe.isCancelled() || exe.isDone())
continue;
executeWithCatching(() -> exe.cancel(true), exceptionWrapper);
}
for (KeyColumnValueStore kcvs : openStores) {
executeWithCatching(kcvs::close, exceptionWrapper);
}
throwIfException(exceptionWrapper);
}
use of org.janusgraph.util.datastructures.ExceptionWrapper in project janusgraph by JanusGraph.
the class KCVSConfiguration method close.
@Override
public void close() {
try {
ExceptionWrapper exceptionWrapper = new ExceptionWrapper();
executeWithCatching(store::close, exceptionWrapper);
executeWithCatching(txProvider::close, exceptionWrapper);
IOUtils.closeQuietly(serializer);
throwIfException(exceptionWrapper);
} catch (BackendException e) {
throw new JanusGraphException("Could not close configuration store", e);
}
}
use of org.janusgraph.util.datastructures.ExceptionWrapper in project janusgraph by JanusGraph.
the class CQLStoreManager method close.
@Override
public void close() throws BackendException {
try {
ExceptionWrapper exceptionWrapper = new ExceptionWrapper();
executeWithCatching(this::clearJmxMetrics, exceptionWrapper);
executeWithCatching(session::close, exceptionWrapper);
throwIfException(exceptionWrapper);
} finally {
gracefulExecutorServiceShutdown(executorService, threadPoolShutdownMaxWaitTime);
}
}
Aggregations