[
https://issues.apache.org/jira/browse/CASSANDRA-11258?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15257156#comment-15257156
]
Paulo Motta commented on CASSANDRA-11258:
-----------------------------------------
The only thing I mildly dislike about the interfaces is that they throw
exception when it's not possible to acquire or renew the lock, but since this
is quite a common case should we use {{Optional}} and {{boolean}} instead? WDYT
about this definition?
{noformat}
interface Lease {
long getExpiration();
boolean renew(long duration) throws LeaseException;
boolean cancel() throws LeaseException;
boolean isValid();
}
interface LeaseFactory {
Optional<Lease> newLease(long duration, String resource, int priority,
Map<String, String> metadata) throws LeaseException;
}
{noformat}
We would still throw {{LeaseException}} if some unexpected error occur when
trying to acquire, renew or cancel the lock.
bq. I think the LeaseMap(mentioned in the JINI lease spec) or a similar
interface will be useful for locking multiple data centers.
sounds good, but we can probably revisit and extend the library when adding
multi-DC support.
Also, we should probably add another field "isActive" to
{{resource_lease_priority}}, to avoid try acquiring a higher priority lock (and
contend on CAS) if a lower priority lock is currently held.
> Repair scheduling - Resource locking API
> ----------------------------------------
>
> Key: CASSANDRA-11258
> URL: https://issues.apache.org/jira/browse/CASSANDRA-11258
> Project: Cassandra
> Issue Type: Sub-task
> Reporter: Marcus Olsson
> Assignee: Marcus Olsson
> Priority: Minor
>
> Create a resource locking API & implementation that is able to lock a
> resource in a specified data center. It should handle priorities to avoid
> node starvation.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)