Confusion with "Lock write succeeded but took too long" warning

"" <cjx...@...>

Environment: JG-0.5.2 with HBase and Elasticsearch

When running a java program to delete verteics and edges, many warnings "Lock write succeeded but took too long" show up.

Wanting to know what happens, I check the code and got confused,

protected ConsistentKeyLockStatus writeSingleLock(KeyColumn lockID, StoreTransaction txh) throws Throwable {

final StaticBuffer lockKey = serializer.toLockKey(lockID.getKey(), lockID.getColumn());
StaticBuffer oldLockCol = null;

for (int i = 0; i < lockRetryCount; i++) {
WriteResult wr = tryWriteLockOnce(lockKey, oldLockCol, txh);
if (wr.isSuccessful() && wr.getDuration().compareTo(lockWait) <= 0) {
final Instant writeInstant = wr.getWriteTimestamp();
final Instant expireInstant =;
return new ConsistentKeyLockStatus(writeInstant, expireInstant);
oldLockCol = wr.getLockCol();
handleMutationFailure(lockID, lockKey, wr, txh);
tryDeleteLockOnce(lockKey, oldLockCol, txh);
// TODO log exception or successful too-slow write here
throw new TemporaryBackendException("Lock write retry count exceeded");

In the code shown above, when wr.getDuration()  greater than lockWait, the warning "Lock write succeeded but took too long" will be printed, and than continue the for loop until to limit.  

And my confusion is that why we continue the for loop when the write is successful (even though it took too long, it's still a successful operation, right?)

Any help would be greatly appreciated.

Join to automatically receive all group messages.