Revision 6818
Added by Chris Jones about 13 years ago
src/edu/ucsb/nceas/metacat/dataone/MNodeService.java | ||
---|---|---|
460 | 460 |
Session thisNodeSession = null; |
461 | 461 |
SystemMetadata localSystemMetadata = null; |
462 | 462 |
BaseException failure = null; |
463 |
|
|
463 |
String localId = null; |
|
464 |
|
|
464 | 465 |
// TODO: check credentials |
465 | 466 |
// cannot be called by public |
466 | 467 |
if (session == null) { |
... | ... | |
491 | 492 |
try { |
492 | 493 |
// do we already have a replica? |
493 | 494 |
try { |
494 |
localSystemMetadata = |
|
495 |
HazelcastService.getInstance().getSystemMetadataMap().get(pid); |
|
496 |
String localId = IdentifierManager.getInstance().getLocalId(sysmeta.getIdentifier().getValue()); |
|
495 |
localId = IdentifierManager.getInstance().getLocalId(pid.getValue()); |
|
497 | 496 |
object = MetacatHandler.read(localId); |
498 | 497 |
|
499 |
} catch (RuntimeException e) { |
|
500 |
String msg = "An error occurred getting system metadata for " + |
|
501 |
pid.getValue(); |
|
502 |
failure = new ServiceFailure("2151", msg); |
|
503 |
setReplicationStatus(thisNodeSession, pid, nodeId, ReplicationStatus.FAILED, failure); |
|
504 |
logMetacat.error(msg); |
|
505 |
return true; |
|
506 |
|
|
507 | 498 |
} catch (McdbDocNotFoundException e) { |
508 |
// TODO Auto-generated catch block |
|
509 |
e.printStackTrace(); |
|
499 |
logMetacat.info("No replica found. Continuing."); |
|
510 | 500 |
|
511 | 501 |
} catch (PropertyNotFoundException e) { |
512 | 502 |
// TODO Auto-generated catch block |
... | ... | |
583 | 573 |
try { |
584 | 574 |
// skip the MN.create -- this mutates the system metadata and we |
585 | 575 |
// dont want it to |
586 |
retPid = super.create(session, pid, object, sysmeta); |
|
587 |
result = (retPid.getValue().equals(pid.getValue())); |
|
576 |
if ( localId == null ) { |
|
577 |
|
|
578 |
retPid = super.create(session, pid, object, sysmeta); |
|
579 |
result = (retPid.getValue().equals(pid.getValue())); |
|
580 |
} |
|
588 | 581 |
|
589 | 582 |
} catch (InvalidToken e) { |
590 | 583 |
String msg = "Could not save object to local store (InvalidToken): " + e.getMessage(); |
Also available in: Unified diff
Only call super.create() if there's no localId found on the MN (ie a replica is there from an out of band process).