if(isAlreadyRunning(store)){
log.debug("Async job found to be already running. Skipping");
return;
}
NodeBuilder builder = store.getRoot().builder();
NodeBuilder async = builder.child(ASYNC);
NodeState before = null;
final PropertyState state = async.getProperty(name);
if (state != null && state.getType() == STRING) {
before = store.retrieve(state.getValue(STRING));
}
if (before == null) {
before = MISSING_NODE;
}
AsyncUpdateCallback callback = new AsyncUpdateCallback();
IndexUpdate indexUpdate = new IndexUpdate(provider, name, after,
builder, callback);
CommitFailedException exception = EditorDiff.process(indexUpdate,
before, after);
if (exception == null && callback.dirty) {
async.setProperty(name, checkpoint);
try {
store.merge(builder, new CommitHook() {
@Override @Nonnull
public NodeState processCommit(NodeState before,
NodeState after) throws CommitFailedException {