Revision 6867
Added by Chris Jones almost 13 years ago
src/edu/ucsb/nceas/metacat/dataone/CNodeService.java | ||
---|---|---|
144 | 144 |
try { |
145 | 145 |
lock = HazelcastService.getInstance().getLock(pid.getValue()); |
146 | 146 |
lock.lock(); |
147 |
logMetacat.debug("Locked identifier " + pid.getValue()); |
|
147 | 148 |
|
148 | 149 |
try { |
149 | 150 |
if ( HazelcastService.getInstance().getSystemMetadataMap().containsKey(pid) ) { |
... | ... | |
231 | 232 |
try { |
232 | 233 |
lock = HazelcastService.getInstance().getLock(pid.getValue()); |
233 | 234 |
lock.lock(); |
235 |
logMetacat.debug("Locked identifier " + pid.getValue()); |
|
236 |
|
|
234 | 237 |
try { |
235 | 238 |
systemMetadata = HazelcastService.getInstance().getSystemMetadataMap().get(pid); |
236 | 239 |
|
... | ... | |
341 | 344 |
|
342 | 345 |
} |
343 | 346 |
|
344 |
} catch (Exception e) { |
|
347 |
} catch (RuntimeException e) { |
|
348 |
String msg = "There was a RuntimeException getting the lock for " + |
|
349 |
pid.getValue(); |
|
350 |
logMetacat.info(msg); |
|
351 |
|
|
352 |
} finally { |
|
345 | 353 |
lock.unlock(); |
346 | 354 |
logMetacat.debug("Unlocked identifier " + pid.getValue()); |
347 | 355 |
|
... | ... | |
689 | 697 |
try { |
690 | 698 |
lock = HazelcastService.getInstance().getLock(sysmeta.getIdentifier().getValue()); |
691 | 699 |
lock.lock(); |
700 |
logMetacat.debug("Locked identifier " + pid.getValue()); |
|
692 | 701 |
logMetacat.debug("Checking if identifier exists..."); |
693 | 702 |
// Check that the identifier does not already exist |
694 | 703 |
if (HazelcastService.getInstance().getSystemMetadataMap().containsKey(pid)) { |
... | ... | |
835 | 844 |
SystemMetadata systemMetadata = null; |
836 | 845 |
try { |
837 | 846 |
lock = HazelcastService.getInstance().getLock(pid.getValue()); |
838 |
|
|
847 |
logMetacat.debug("Locked identifier " + pid.getValue()); |
|
848 |
|
|
839 | 849 |
try { |
840 | 850 |
systemMetadata = HazelcastService.getInstance().getSystemMetadataMap().get(pid); |
841 | 851 |
|
... | ... | |
946 | 956 |
|
947 | 957 |
} |
948 | 958 |
|
949 |
//lock, get, and unlock the pid |
|
950 |
lock = HazelcastService.getInstance().getLock(pid.getValue()); |
|
951 |
lock.lock(); |
|
952 | 959 |
logMetacat.debug("Getting system metadata for identifier " + pid.getValue()); |
953 | 960 |
|
954 | 961 |
sysmeta = HazelcastService.getInstance().getSystemMetadataMap().get(pid); |
... | ... | |
993 | 1000 |
sf.initCause(e); |
994 | 1001 |
throw sf; |
995 | 1002 |
|
996 |
} finally { |
|
997 |
// always unlock the pid |
|
998 |
lock.unlock(); |
|
999 |
logMetacat.debug("Unlocked identifier " + pid.getValue()); |
|
1000 |
|
|
1001 | 1003 |
} |
1002 | 1004 |
|
1003 | 1005 |
return isAllowed; |
... | ... | |
1058 | 1060 |
// create the coordinating node version of the document |
1059 | 1061 |
lock = HazelcastService.getInstance().getLock(pid.getValue()); |
1060 | 1062 |
lock.lock(); |
1063 |
logMetacat.debug("Locked identifier " + pid.getValue()); |
|
1061 | 1064 |
sysmeta.setSerialVersion(BigInteger.ONE); |
1062 | 1065 |
sysmeta.setDateSysMetadataModified(Calendar.getInstance().getTime()); |
1063 | 1066 |
pid = super.create(session, pid, object, sysmeta); |
... | ... | |
1125 | 1128 |
try { |
1126 | 1129 |
lock = HazelcastService.getInstance().getLock(pid.getValue()); |
1127 | 1130 |
lock.lock(); |
1128 |
|
|
1131 |
logMetacat.debug("Locked identifier " + pid.getValue()); |
|
1132 |
|
|
1129 | 1133 |
try { |
1130 | 1134 |
systemMetadata = HazelcastService.getInstance().getSystemMetadataMap().get(pid); |
1131 | 1135 |
|
... | ... | |
1220 | 1224 |
try { |
1221 | 1225 |
lock = HazelcastService.getInstance().getLock(pid.getValue()); |
1222 | 1226 |
lock.lock(); |
1227 |
logMetacat.debug("Locked identifier " + pid.getValue()); |
|
1223 | 1228 |
|
1224 | 1229 |
try { |
1225 | 1230 |
systemMetadata = HazelcastService.getInstance().getSystemMetadataMap().get(pid); |
Also available in: Unified diff
Don't lock() on the map.get() in isNodeAuthorized() (this assumes that the CN has queued the task already). Add more lock/unlock debug statements, and fix setReplicationStatus() - I missed a finally statement to unlock the pid.