Skip to content
This repository has been archived by the owner on Sep 16, 2021. It is now read-only.

Commit

Permalink
Use resourceId for consistency
Browse files Browse the repository at this point in the history
  • Loading branch information
kahowell committed May 11, 2016
1 parent 0318e2a commit f84fd76
Showing 1 changed file with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@

public class LockingRoutePolicy extends RoutePolicySupport {

private final String identifier;
private final String resourceId;

private final LockStrategy lockStrategy;

private @Nullable LockedResource<String> lock;

public LockingRoutePolicy(String identifier, LockStrategy lockStrategy) {
this.identifier = identifier;
public LockingRoutePolicy(String resourceId, LockStrategy lockStrategy) {
this.resourceId = resourceId;
this.lockStrategy = lockStrategy;
}

Expand All @@ -38,16 +38,16 @@ public synchronized void onExchangeBegin(Route route, Exchange exchange) {
lock.ensureAcquiredOrThrow("Lost lock");
return;
} catch (LostLockException e) {
log.warn("Lost lock w id: " + identifier + ", trying to reacquire...", e);
log.warn("Lost lock w id: " + resourceId + ", trying to reacquire...", e);
lock = null;
}
}

try {
lock = lockStrategy.tryAcquire(identifier);
lock = lockStrategy.tryAcquire(resourceId);
} catch (LockNotAvailableException e) {
log.debug("Lock not available, assuming " +
"another thread is holding lock w/ id: " + identifier, e);
"another thread is holding lock w/ id: " + resourceId, e);
exchange.setProperty(Exchange.ROUTE_STOP, Boolean.TRUE);
}
}
Expand All @@ -58,7 +58,7 @@ private synchronized void releaseLock() {
try {
lock.close();
} catch (IOException e) {
log.warn("IOException trying to release lock w/ identifier " + identifier, e);
log.warn("IOException trying to release lock w/ identifier " + resourceId, e);
}

lock = null;
Expand Down

0 comments on commit f84fd76

Please sign in to comment.