Revision 6447
Added by ben leinfelder over 12 years ago
ReplicationService.java | ||
---|---|---|
78 | 78 |
import edu.ucsb.nceas.metacat.database.DBConnection; |
79 | 79 |
import edu.ucsb.nceas.metacat.database.DBConnectionPool; |
80 | 80 |
import edu.ucsb.nceas.metacat.database.DatabaseService; |
81 |
import edu.ucsb.nceas.metacat.dataone.hazelcast.HazelcastService; |
|
81 | 82 |
import edu.ucsb.nceas.metacat.properties.PropertyService; |
82 | 83 |
import edu.ucsb.nceas.metacat.shared.BaseService; |
83 | 84 |
import edu.ucsb.nceas.metacat.shared.HandlerException; |
... | ... | |
589 | 590 |
TypeMarshaller.unmarshalTypeFromStream( |
590 | 591 |
SystemMetadata.class, |
591 | 592 |
new ByteArrayInputStream(systemMetadataXML.getBytes("UTF-8"))); |
592 |
String guid = sysMeta.getIdentifier().getValue(); |
|
593 |
if (!IdentifierManager.getInstance().identifierExists(guid)) { |
|
594 |
logReplication.debug("Creating system metadata and guid/docid mapping for docid " |
|
595 |
+ docinfoHash.get("docid") |
|
596 |
+ " and guid: " |
|
597 |
+ guid); |
|
598 |
IdentifierManager.getInstance().createMapping(guid, docinfoHash.get("docid")); |
|
599 |
IdentifierManager.getInstance().createSystemMetadata(sysMeta); |
|
600 |
} else { |
|
601 |
logReplication.debug("Updating guid/docid mapping for docid " |
|
602 |
+ docinfoHash.get("docid") + " and guid: " |
|
603 |
+ guid); |
|
604 |
IdentifierManager.getInstance().updateMapping(guid, docinfoHash.get("docid")); |
|
605 |
} |
|
606 |
IdentifierManager.getInstance().updateSystemMetadata(sysMeta); |
|
593 |
HazelcastService.getInstance().getSystemMetadataMap().put(sysMeta.getIdentifier(), sysMeta); |
|
607 | 594 |
} |
608 | 595 |
|
609 | 596 |
// replicate doc contents |
... | ... | |
870 | 857 |
TypeMarshaller.unmarshalTypeFromStream( |
871 | 858 |
SystemMetadata.class, |
872 | 859 |
new ByteArrayInputStream(systemMetadataXML.getBytes("UTF-8"))); |
873 |
String guid = sysMeta.getIdentifier().getValue(); |
|
874 |
if (!IdentifierManager.getInstance().identifierExists(guid)) { |
|
875 |
logReplication.debug("Creating system metadata and guid/docid mapping for docid " + docinfoHash.get("docid") + " and guid: " + guid); |
|
876 |
IdentifierManager.getInstance().createMapping(guid, docinfoHash.get("docid")); |
|
877 |
IdentifierManager.getInstance().createSystemMetadata(sysMeta); |
|
878 |
} else { |
|
879 |
logReplication.debug("Updating guid/docid mapping for docid " + docinfoHash.get("docid") + " and guid: " + guid); |
|
880 |
IdentifierManager.getInstance().updateMapping(guid, docinfoHash.get("docid")); |
|
881 |
} |
|
882 |
IdentifierManager.getInstance().updateSystemMetadata(sysMeta); |
|
860 |
HazelcastService.getInstance().getSystemMetadataMap().put(sysMeta.getIdentifier(), sysMeta); |
|
883 | 861 |
} |
884 | 862 |
|
885 | 863 |
if (writeException != null) { |
... | ... | |
1081 | 1059 |
TypeMarshaller.unmarshalTypeFromStream( |
1082 | 1060 |
SystemMetadata.class, |
1083 | 1061 |
new ByteArrayInputStream(systemMetadataXML.getBytes("UTF-8"))); |
1084 |
if (!IdentifierManager.getInstance().identifierExists(guid)) { |
|
1085 |
logReplication.debug("Creating system metadata for guid: " + guid); |
|
1086 |
IdentifierManager.getInstance().createSystemMetadata(sysMeta); |
|
1087 |
} |
|
1088 |
IdentifierManager.getInstance().updateSystemMetadata(sysMeta); |
|
1062 |
HazelcastService.getInstance().getSystemMetadataMap().put(sysMeta.getIdentifier(), sysMeta); |
|
1089 | 1063 |
} |
1090 | 1064 |
|
1091 | 1065 |
logReplication.info("ReplicationService.handleForceReplicateSystemMetadataRequest - processed guid: " + guid); |
Also available in: Unified diff
rely on Hazelcast to store the SystemMetadata locally for the node. Entry event listeners store the shared system metadata on their local node when alerted. TODO: remove old replication code that included system metadata xml when replicating scimeta and data