Skip to content

Commit

Permalink
Merge pull request #9 from CDLUC3/lockLogic
Browse files Browse the repository at this point in the history
More logic for acquire lock.  Is it needed?
  • Loading branch information
mreyescdl authored Feb 7, 2025
2 parents 2142a28 + 16d55cf commit 6557bf6
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/main/java/org/cdlib/mrt/zk/QueueItem.java
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,8 @@ public void setStatusTrigger(ZooKeeper client) throws MerrittZKNodeInvalid, Keep
public boolean lock(ZooKeeper client) throws InterruptedException {
String statpath = makePath(ZKKey.LOCK);
try {
if (! QueueItemHelper.createEphemeral(client, statpath, QueueItemHelper.empty).isEmpty())
if (client.exists(statpath, null) != null) return false;
if (QueueItemHelper.createEphemeral(client, statpath, QueueItemHelper.empty).equals(statpath))
return true;
else
return false;
Expand Down

0 comments on commit 6557bf6

Please sign in to comment.