Skip to content

Commit

Permalink
fix ttl not work due to job not close tx (#1330)
Browse files Browse the repository at this point in the history
Change-Id: I0f473063f6df1e43170f01a655a87a1c790f028a
  • Loading branch information
zhoney authored Jan 13, 2021
1 parent 52a8aae commit e0f36bd
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,11 @@ public V call() throws Exception {

@Override
protected void done() {
this.save();
try {
this.save();
} finally {
super.done();
}
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,11 @@ public V call() throws Exception {

@Override
protected void done() {
this.save();
try {
this.save();
} finally {
super.done();
}
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import java.util.Date;
import java.util.concurrent.Callable;

import org.apache.tinkerpop.gremlin.structure.Transaction;
import org.slf4j.Logger;

import com.baidu.hugegraph.HugeException;
Expand All @@ -48,13 +49,20 @@ public TaskCallable() {
}

protected void done() {
// Do nothing, subclasses may override this method
this.closeTx();
}

protected void cancelled() {
// Do nothing, subclasses may override this method
}

protected void closeTx() {
Transaction tx = this.graph().tx();
if (tx.isOpen()) {
tx.close();
}
}

public void setMinSaveInterval(long seconds) {
E.checkArgument(seconds > 0,
"Must set interval > 0, bug got '%s'", seconds);
Expand Down

0 comments on commit e0f36bd

Please sign in to comment.