Project

General

Profile

« Previous | Next » 

Revision 9111

Added by Jing Tao almost 10 years ago

Call the method lock.lock() immediately after getting the lock. Otherwise, if an exception happened between the two calls (in another word, lock.lock() was called), lock.unlock() can cause an issue:
Current thread is not owner of lock!
See https://redmine.dataone.org/issues/6836.

View differences:

src/edu/ucsb/nceas/metacat/dataone/CNodeService.java
1572 1572

  
1573 1573
      try {
1574 1574
          lock = HazelcastService.getInstance().getLock(pid.getValue());
1575
          lock.lock();
1575 1576
          // are we allowed?
1576 1577
          boolean isAllowed = false;
1577 1578
          isAllowed = isAdminAuthorized(session);
......
1586 1587
              //check if the series id is legitimate. It uses the same rules of the method registerSystemMetadata
1587 1588
              checkSidInModifyingSystemMetadata(sysmeta, "4896", "4893");
1588 1589
              // create the coordinating node version of the document      
1589
              lock.lock();
1590 1590
              logMetacat.debug("Locked identifier " + pid.getValue());
1591 1591
              sysmeta.setSerialVersion(BigInteger.ONE);
1592 1592
              sysmeta.setDateSysMetadataModified(Calendar.getInstance().getTime());

Also available in: Unified diff