Search in sources :

Example 1 with HugeGraphParams

use of com.baidu.hugegraph.HugeGraphParams in project incubator-hugegraph by apache.

the class DeleteExpiredIndexJob method execute.

@Override
public V execute() throws Exception {
    LOG.debug("Delete expired indexes: {}", this.indexes);
    HugeGraphParams graph = this.params();
    GraphTransaction tx = graph.graphTransaction();
    try {
        for (HugeIndex index : this.indexes) {
            this.deleteExpiredIndex(graph, index);
        }
        tx.commit();
    } catch (Throwable e) {
        tx.rollback();
        LOG.warn("Failed to delete expired indexes: {}", this.indexes);
        throw e;
    } finally {
        JOB_COUNTERS.jobCounter(graph.graph()).decrement();
    }
    return null;
}
Also used : HugeGraphParams(com.baidu.hugegraph.HugeGraphParams) GraphTransaction(com.baidu.hugegraph.backend.tx.GraphTransaction) HugeIndex(com.baidu.hugegraph.structure.HugeIndex)

Example 2 with HugeGraphParams

use of com.baidu.hugegraph.HugeGraphParams in project incubator-hugegraph by apache.

the class DeleteExpiredElementJob method execute.

@Override
public V execute() throws Exception {
    LOG.debug("Delete expired elements: {}", this.elements);
    HugeGraphParams graph = this.params();
    GraphTransaction tx = graph.graphTransaction();
    try {
        for (HugeElement element : this.elements) {
            element.remove();
        }
        tx.commit();
    } catch (Exception e) {
        tx.rollback();
        LOG.warn("Failed to delete expired elements: {}", this.elements);
        throw e;
    } finally {
        JOB_COUNTERS.jobCounter(graph.graph()).decrement();
    }
    return null;
}
Also used : HugeGraphParams(com.baidu.hugegraph.HugeGraphParams) GraphTransaction(com.baidu.hugegraph.backend.tx.GraphTransaction) HugeElement(com.baidu.hugegraph.structure.HugeElement)

Aggregations

HugeGraphParams (com.baidu.hugegraph.HugeGraphParams)2 GraphTransaction (com.baidu.hugegraph.backend.tx.GraphTransaction)2 HugeElement (com.baidu.hugegraph.structure.HugeElement)1 HugeIndex (com.baidu.hugegraph.structure.HugeIndex)1