Project

General

Profile

« Previous | Next » 

Revision 9288

Added by Jing Tao over 9 years ago

Use the status of mn.ping to guess the version of the source node in the replicate method.

View differences:

src/edu/ucsb/nceas/metacat/dataone/MNodeService.java
712 712
            
713 713
            // no local replica, get a replica
714 714
            if ( object == null ) {
715
                if(!supportV2Replication(mn.getCapabilities())) {
716
                    //the source node is not a v2 node, we should use the v1 replication
717
                    //this should be change when v3, v4 and et al comes out
715
                boolean success = true;
716
                try {
717
                    //use the v2 ping api to connect the source node
718
                    mn.ping();
719
                } catch (Exception e) {
720
                    success = false;
721
                }
722
                
723
                if(!success) {
724
                    //The failure maybe is caused by that the source node is not a v2 node. We try to use the v1 replication.
725
                    //If the failure is not caused by the version issue (e.g., it is a network connection issue), the following 
726
                    //command will fail as well.
718 727
                    org.dataone.client.v1.MNode mNodeV1 =  org.dataone.client.v1.itk.D1Client.getMN(sourceNode);
719 728
                    object = mNodeV1.get(thisNodeSession, pid);
720 729
                } else {

Also available in: Unified diff