Project

General

Profile

« Previous | Next » 

Revision 9350

Added by Jing Tao over 9 years ago

In the archive method, add the lock.

View differences:

src/edu/ucsb/nceas/metacat/dataone/CNodeService.java
595 595
      try {
596 596
          localId = IdentifierManager.getInstance().getLocalId(pid.getValue());
597 597
          super.archive(session, pid);
598
          
598
          SystemMetadata sysMeta = HazelcastService.getInstance().getSystemMetadataMap().get(pid);
599
          notifyReplicaNodes(sysMeta);
600
      
599 601
      } catch (McdbDocNotFoundException e) {
600 602
          // This object is not registered in the identifier table. Assume it is of formatType DATA,
601 603
    	  // and set the archive flag. (i.e. the *object* doesn't exist on the CN)
src/edu/ucsb/nceas/metacat/dataone/D1NodeService.java
1982 1982
              EventLog.getInstance().log(request.getRemoteAddr(), request.getHeader("User-Agent"), username, localId, Event.DELETE.xmlValue());
1983 1983

  
1984 1984
              // archive it
1985
              HazelcastService.getInstance().getSystemMetadataMap().lock(pid);
1985 1986
              SystemMetadata sysMeta = HazelcastService.getInstance().getSystemMetadataMap().get(pid);
1986 1987
              sysMeta.setArchived(true);
1987 1988
              sysMeta.setDateSysMetadataModified(Calendar.getInstance().getTime());
1989
              sysMeta.setSerialVersion(sysMeta.getSerialVersion().add(BigInteger.ONE));
1988 1990
              HazelcastService.getInstance().getSystemMetadataMap().put(pid, sysMeta);
1991
              
1989 1992
              // submit for indexing
1990 1993
              // DocumentImpl call above should do this.
1991 1994
              // see: https://projects.ecoinformatics.org/ecoinfo/issues/6030
......
2002 2005

  
2003 2006
          } catch (Exception e) { // for some reason DocumentImpl throws a general Exception
2004 2007
              throw new ServiceFailure("1350", "There was a problem archiving the object." + "The error message was: " + e.getMessage());
2008
          } finally {
2009
              HazelcastService.getInstance().getSystemMetadataMap().unlock(pid);
2010
              logMetacat.debug("D1NodeService.archive - unlock the system metadata map in hazelcast for the pid "+pid.getValue());
2005 2011
          }
2006 2012

  
2007 2013
      } else {

Also available in: Unified diff