MCPcopy Index your code
hub / github.com/careercup/ctci / getLock

Method getLock

java/Chapter 16/Question16_4/LockFactory.java:91–103  ·  view source on GitHub ↗
(int ownerId, int resourceID)

Source from the content-addressed store, hash-verified

89 /* Get the lock, verifying first that the process is really calling the locks in the order
90 * it said it would. */
91 public Lock getLock(int ownerId, int resourceID) {
92 LinkedList<LockNode> list = lockOrder.get(ownerId);
93 if (list == null) {
94 return null;
95 }
96
97 LockNode head = list.getFirst();
98 if (head.getId() == resourceID) {
99 list.removeFirst();
100 return head.getLock();
101 }
102 return null;
103 }
104}

Callers 1

mainMethod · 0.95

Calls 3

getIdMethod · 0.95
getLockMethod · 0.95
getMethod · 0.45

Tested by

no test coverage detected