go through the replication methods to see if there are ones
            that does not require a working replication connection.
438366
def can_create_replica_without_replication_connection(self):
        
        replica_methods = self._create_replica_methods
        return any(self.replica_method_can_work_without_replication_connection(method) for method in replica_methods)
320898
def _check_self_replicate(self, myntr):
        
        # print 'BFS Dictionary Update - Self Replicate'
        find = 0
        for nonterm in self.grammar.grammar_nonterminals_map:
            for i in self.grammar.grammar_nonterminals_map[nonterm]:
                if self.grammar.grammar_rules[i][0] not in self.resolved and not isinstance(
                        self.grammar.grammar_rules[i][1], (set, tuple)) \
                        and self.grammar.grammar_rules[i][1] == myntr:
                    self.resolved[self.grammar.grammar_rules[i][0]] = self.resolved[myntr]
                    if self._checkfinal(self.grammar.grammar_rules[i][0]):
                        return self.resolved[self.grammar.grammar_rules[i][0]]
                    if self.grammar.grammar_rules[i][0] not in self.bfs_queue:
                        self.bfs_queue.append(self.grammar.grammar_rules[i][0])
                    find = 1
        if find == 1:
            return 1
        return 0
1046261
@Subscribe
    public void complete(ReplicationCompleted rc) {
        mHandler.post(new Runnable() {
            @Override
            public void run() {
                if (mListener != null) {
                    mListener.replicationComplete();
                }
            }
        });
    }
649602
def _check_repos(self, repos):
        """"""
        self._checking_repos = []
        self._valid_repos = []

        for repo in repos:
            worker = self.download_is_valid_url(repo)
            worker.sig_finished.connect(self._repos_checked)
            worker.repo = repo
            self._checking_repos.append(repo)
708285
private void doRun() {
        if (migrationInfo.startProcessing()) {
            try {
                if (firstFragment) {
                    executeBeforeMigrations();
                }

                for (Operation migrationOperation : fragmentMigrationState.getMigrationOperations()) {
                    runMigrationOperation(migrationOperation);
                }

                success = true;
            } catch (Throwable e) {
                failureReason = e;
                getLogger().severe("Error while executing replication operations " + migrationInfo, e);
            } finally {
                afterMigrate();
            }
        } else {
            logMigrationCancelled();
        }
    }
733636
private DatanodeDescriptor[] chooseTarget(ReplicationWork work) {
    if (!neededReplications.contains(work.block)) {
      return null;
    }
    if (work.blockSize == BlockFlags.NO_ACK) {
      LOG.warn("Block " + work.block.getBlockId() + 
          " of the file " + getFullPathName(work.fileINode) + 
          " is invalidated and cannot be replicated.");
      return null;
    }
    if (work.blockSize == BlockFlags.DELETED) {
      LOG.warn("Block " + work.block.getBlockId() + 
          " of the file " + getFullPathName(work.fileINode) + 
          " is a deleted block and cannot be replicated.");
      return null;
    }
    return replicator.chooseTarget(work.fileINode,
        work.numOfReplicas, work.srcNode,
        work.containingNodes, null, work.blockSize);
  }
463346
def _check_connectivity(self, err):

        '''  '''
        
        try:
            import requests
            requests.get(self.uptime_ssl)
        except:
            from requests import Request
            request_object = Request(method='GET', url=self.uptime_ssl)
            request_details = self.handle_requests(request_object)
            self.printer('ERROR.')
            raise ConnectionError(request_details['error'])
        self.printer('ERROR.')
        raise err
1167647
public void setReplicaUpdates(java.util.Collection<ReplicaUpdate> replicaUpdates) {
        if (replicaUpdates == null) {
            this.replicaUpdates = null;
            return;
        }

        this.replicaUpdates = new java.util.ArrayList<ReplicaUpdate>(replicaUpdates);
    }
718706
public boolean remoteExists(URI uri) throws IOException {
    try {
      FileSystems.matchSingleFileSpec(uri.toString());
      return true;
    } catch (FileNotFoundException e) {
      return false;
    }
  }
1100802
def _check_has_primary(sds):
    
    for s in sds.values():
        if s.server_type == SERVER_TYPE.RSPrimary:
            return TOPOLOGY_TYPE.ReplicaSetWithPrimary
    else:
        return TOPOLOGY_TYPE.ReplicaSetNoPrimary
334461
private static Map<String, Object> getActivity(Replication replicator) {
        // For schema, see http://wiki.apache.org/couchdb/HttpGetActiveTasks
        Map<String, Object> activity = new HashMap<String, Object>();

        String source = replicator.getRemoteUrl().toExternalForm();
        String target = replicator.getLocalDatabase().getName();

        if (!replicator.isPull()) {
            String tmp = source;
            source = target;
            target = tmp;
        }
        int processed = replicator.getCompletedChangesCount();
        int total = replicator.getChangesCount();
        String status = String.format(Locale.ENGLISH, "Processed %d / %d changes", processed, total);
        if (!replicator.getStatus().equals(ReplicationStatus.REPLICATION_ACTIVE)) {
            //These values match the values for IOS.
            if (replicator.getStatus().equals(ReplicationStatus.REPLICATION_IDLE)) {
                status = "Idle";     // nonstandard
            } else if (replicator.getStatus().equals(ReplicationStatus.REPLICATION_STOPPED)) {
                status = "Stopped";
            } else if (replicator.getStatus().equals(ReplicationStatus.REPLICATION_OFFLINE)) {
                status = "Offline";  // nonstandard
            }
        }
        int progress = (total > 0) ? (int) 100 * processed / total : 0;

        activity.put("type", "Replication");
        activity.put("task", replicator.getSessionID());
        activity.put("source", source);
        activity.put("target", target);
        activity.put("status", status);
        activity.put("progress", progress);
        activity.put("continuous", replicator.isContinuous());

        //NOTE: Need to support "x_active_requests"

        if (replicator.getLastError() != null) {
            String msg = String.format(Locale.ENGLISH, "Replicator error: %s.  Repl: %s.  Source: %s, Target: %s",
                    replicator.getLastError(), replicator, source, target);
            Log.w(TAG, msg);
            Throwable error = replicator.getLastError();
            int statusCode = 400;
            if (error instanceof RemoteRequestResponseException) {
                statusCode = ((RemoteRequestResponseException) error).getCode();
            }
            Object[] errorObjects = new Object[]{statusCode, replicator.getLastError().toString()};
            activity.put("error", errorObjects);
        } else {
            // NOTE: Following two parameters: CBL iOS does not support. We might remove them in the future.
            activity.put("change_count", total);
            activity.put("completed_change_count", processed);
        }

        return activity;
    }
455435
public void setReplicationInstancePrivateIpAddresses(java.util.Collection<String> replicationInstancePrivateIpAddresses) {
        if (replicationInstancePrivateIpAddresses == null) {
            this.replicationInstancePrivateIpAddresses = null;
            return;
        }

        this.replicationInstancePrivateIpAddresses = new java.util.ArrayList<String>(replicationInstancePrivateIpAddresses);
    }
1159070
void replicationComplete() {
        reloadTasksFromModel();
        Toast.makeText(getApplicationContext(),
                R.string.replication_completed,
                Toast.LENGTH_LONG).show();
        dismissDialog(DIALOG_PROGRESS);
    }
333648
@Override
  public Optional<List<CopyRoute>> getPushRoutes(ReplicationConfiguration rc, EndPoint copyFrom) {
    if (rc.getCopyMode() == ReplicationCopyMode.PULL)
      return Optional.absent();

    DataFlowTopology topology = rc.getDataFlowToplogy();
    List<DataFlowTopology.DataFlowPath> paths = topology.getDataFlowPaths();

    for (DataFlowTopology.DataFlowPath p : paths) {
      /**
       * Routes are list of pairs that generated from config in the format of topology specification.
       * For example, source:[holdem, war] will end up with
       * List<(source, holdem), (source, war)>
       */
      List<CopyRoute> routes = p.getCopyRoutes();

      if (routes.isEmpty()) {
        continue;
      }

      // All the routes should has the same copyFrom but different copyTo.
      if (routes.get(0).getCopyFrom().equals(copyFrom)) {
        return Optional.of(routes);
      }
    }
    return Optional.absent();
  }
39901
protected void startReplications() {
        if (mReplicationPolicyManager != null) {
            // Make sure we've got a WiFi lock so that the wifi isn't switched off while we're
            // trying to replicate.
            if (mWifiLock != null) {
                synchronized (mWifiLock) {
                    if (!mWifiLock.isHeld()) {
                        mWifiLock.acquire();
                    }
                }
            }
            mReplicationPolicyManager.startReplications();
        }
    }
107009
private boolean checkVmIsStarted() {

		DescribeInstancesRequest dis = new DescribeInstancesRequest();
		dis.setInstanceIds(Collections.singletonList(this.machineId));

		DescribeInstancesResult disresult = this.ec2Api.describeInstances( dis );
		// Obtain availability zone (for later use, eg. volume attachment).
		// Necessary if no availability zone is specified in configuration
		// (because volumes must be attached to instances in the same availability zone).
		this.availabilityZone = disresult.getReservations().get(0).getInstances().get(0).getPlacement().getAvailabilityZone();
		return "running".equalsIgnoreCase( disresult.getReservations().get(0).getInstances().get(0).getState().getName());
	}
58366
def replicate(self, info_in):
        """"""
        # check self is not failed
        if self.failed:
            raise ValueError("{} cannot replicate as it has failed."
                             .format(self))

        from transformations import Replication
        info_out = type(info_in)(origin=self, contents=info_in.contents)
        Replication(info_in=info_in, info_out=info_out)