Revision 8439
Added by Chris Jones almost 11 years ago
src/edu/ucsb/nceas/metacat/dataone/CNodeService.java | ||
---|---|---|
729 | 729 |
|
730 | 730 |
// update the replica nodes about the completed replica when complete |
731 | 731 |
if (status.equals(ReplicationStatus.COMPLETED)) { |
732 |
broadcastSystemMetadataChange(systemMetadata);
|
|
732 |
notifyReplicaNodes(systemMetadata);
|
|
733 | 733 |
} |
734 | 734 |
|
735 | 735 |
} catch (RuntimeException e) { |
... | ... | |
751 | 751 |
return true; |
752 | 752 |
} |
753 | 753 |
|
754 |
/* |
|
755 |
* Inform each replica node that system metadata has changed |
|
756 |
* |
|
757 |
* @param systemMetadata the system metadata object with the replica list |
|
758 |
*/ |
|
759 |
private void broadcastSystemMetadataChange(SystemMetadata systemMetadata) { |
|
760 |
|
|
761 |
CNode cn = null; |
|
762 |
NodeList nodeList = new NodeList(); |
|
763 |
List<Node> nodes = new ArrayList<Node>(); |
|
764 |
|
|
765 |
List<Replica> replicaList = systemMetadata.getReplicaList(); |
|
766 |
|
|
767 |
// get the node list so we know the node type |
|
768 |
try { |
|
769 |
cn = D1Client.getCN(); |
|
770 |
nodeList = cn.listNodes(); |
|
771 |
nodes = nodeList.getNodeList(); |
|
772 |
|
|
773 |
// iterate through the replica list and inform each MN of the system metadata change |
|
774 |
for (Replica replica : replicaList) { |
|
775 |
NodeReference nodeId = replica.getReplicaMemberNode(); |
|
776 |
try { |
|
777 |
for (Node node : nodes) { |
|
778 |
if ( node.getIdentifier().equals(nodeId) ) { |
|
779 |
if ( node.getType().equals(NodeType.MN) ) { |
|
780 |
MNode replicaNode = D1Client.getMN(nodeId); |
|
781 |
// call MN.systemMetadataChanged(); |
|
782 |
replicaNode.systemMetadataChanged(null, |
|
783 |
systemMetadata.getIdentifier(), |
|
784 |
systemMetadata.getSerialVersion().longValue(), |
|
785 |
systemMetadata.getDateSysMetadataModified()); |
|
786 |
if (logMetacat.isDebugEnabled()) { |
|
787 |
logMetacat.debug("Called systemMetadataChanged() for identifier " + |
|
788 |
systemMetadata.getIdentifier().getValue() + |
|
789 |
" for node " + nodeId.getValue()); |
|
790 |
} |
|
791 |
} |
|
792 |
} |
|
793 |
} |
|
794 |
|
|
795 |
} catch (BaseException e) { |
|
796 |
logMetacat.error("Couldn't contact " + nodeId.getValue() + |
|
797 |
" to inform it of the system metadata change for identifier " + |
|
798 |
systemMetadata.getIdentifier().getValue()); |
|
799 |
} |
|
800 |
} |
|
801 |
|
|
802 |
} catch (BaseException e1) { |
|
803 |
logMetacat.error("Couldn't get the node list from the CN to broadcast the system " + |
|
804 |
"metadata change for identifier " + systemMetadata.getIdentifier().getValue()); |
|
805 |
} |
|
806 |
|
|
807 |
|
|
808 |
} |
|
809 |
|
|
810 | 754 |
/** |
811 | 755 |
* Return the checksum of the object given the identifier |
812 | 756 |
* |
... | ... | |
1609 | 1553 |
|
1610 | 1554 |
// inform replica nodes of the change if the status is complete |
1611 | 1555 |
if ( replicaStatus.equals(ReplicationStatus.COMPLETED) ) { |
1612 |
broadcastSystemMetadataChange(systemMetadata);
|
|
1556 |
notifyReplicaNodes(systemMetadata);
|
|
1613 | 1557 |
|
1614 | 1558 |
} |
1615 | 1559 |
} catch (RuntimeException e) { |
Also available in: Unified diff
Remove the broadcastSystemMetadataChange() method since it was a duplicate of notifyReplicaNodes(). Consolidated now.