use of org.janusgraph.core.JanusGraphException in project janusgraph by JanusGraph.
the class StandardJanusGraph method newTransaction.
public StandardJanusGraphTx newTransaction(final TransactionConfiguration configuration) {
if (!isOpen)
ExceptionFactory.graphShutdown();
try {
StandardJanusGraphTx tx = new StandardJanusGraphTx(this, configuration);
tx.setBackendTransaction(openBackendTransaction(tx));
openTransactions.add(tx);
return tx;
} catch (BackendException e) {
throw new JanusGraphException("Could not start new transaction", e);
}
}
use of org.janusgraph.core.JanusGraphException in project janusgraph by JanusGraph.
the class FulgoraGraphComputer method executeIterationOfJob.
private void executeIterationOfJob(VertexProgramScanJob.Executor job, int iteration) {
initializeVertexMemoryForIteration();
StandardScanner.Builder scanBuilder = createScanBuilderForJob(job, iteration);
PartitionedVertexProgramExecutor programExecutor = new PartitionedVertexProgramExecutor(graph, memory, vertexMemory, vertexProgram);
try {
// Iterates over all vertices and computes the vertex program on all non-partitioned vertices. For partitioned ones, the data is aggregated
ScanMetrics jobResult = executeOnNonPartitionedVertices(iteration, scanBuilder);
executeOnPartitionedVertices(iteration, programExecutor, jobResult);
} catch (Exception e) {
throw new JanusGraphException(e);
}
vertexMemory.completeIteration();
}
use of org.janusgraph.core.JanusGraphException in project janusgraph by JanusGraph.
the class StandardLogProcessorFramework method shutdown.
@Override
public synchronized void shutdown() throws JanusGraphException {
if (!isOpen)
return;
isOpen = false;
try {
ExceptionWrapper exceptionWrapper = new ExceptionWrapper();
for (Log log : processorLogs.values()) {
ExecuteUtil.executeWithCatching(log::close, exceptionWrapper);
}
ExecuteUtil.throwIfException(exceptionWrapper);
processorLogs.clear();
} catch (BackendException e) {
throw new JanusGraphException(e);
}
}
use of org.janusgraph.core.JanusGraphException in project janusgraph by JanusGraph.
the class IndexRepairJob method workerIterationEnd.
@Override
public void workerIterationEnd(final ScanMetrics metrics) {
try {
if (index instanceof JanusGraphIndex) {
BackendTransaction mutator = writeTx.getTxHandle();
IndexType indexType = managementSystem.getSchemaVertex(index).asIndexType();
if (indexType.isMixedIndex() && documentsPerStore.size() > 0) {
mutator.getIndexTransaction(indexType.getBackingIndexName()).restore(documentsPerStore);
documentsPerStore = new HashMap<>();
}
}
} catch (BackendException e) {
throw new JanusGraphException(e.getMessage(), e);
} finally {
super.workerIterationEnd(metrics);
}
}
use of org.janusgraph.core.JanusGraphException in project janusgraph by JanusGraph.
the class IndexRemoveJob method process.
@Override
public void process(StaticBuffer key, Map<SliceQuery, EntryList> entries, ScanMetrics metrics) {
// The queries are already tailored enough => everything should be removed
try {
BackendTransaction mutator = writeTx.getTxHandle();
final List<Entry> deletions;
if (entries.size() == 1) {
deletions = entries.values().iterator().next();
} else {
final int size = IteratorUtils.stream(entries.values().iterator()).map(List::size).reduce(0, Integer::sum);
deletions = new ArrayList<>(size);
entries.values().forEach(deletions::addAll);
}
metrics.incrementCustom(DELETED_RECORDS_COUNT, deletions.size());
if (isRelationTypeIndex()) {
mutator.mutateEdges(key, KCVSCache.NO_ADDITIONS, deletions);
} else {
mutator.mutateIndex(key, KCVSCache.NO_ADDITIONS, deletions);
}
} catch (final Exception e) {
managementSystem.rollback();
writeTx.rollback();
metrics.incrementCustom(FAILED_TX);
throw new JanusGraphException(e.getMessage(), e);
}
}
Aggregations