Checks if an Alluxio master node is already running
or not on the master address given.

@return true if master exists, false otherwise
498198
private boolean masterExists() {

    String webPort = mAlluxioConf.get(PropertyKey.MASTER_WEB_PORT);

    try {
      URL myURL = new URL("http://" + mMasterAddress + ":" + webPort + Constants.REST_API_PREFIX + "/master/version");
      LOG.debug("Checking for master at: " + myURL.toString());
      HttpURLConnection connection = (HttpURLConnection) myURL.openConnection();
      connection.setRequestMethod(HttpMethod.GET);
      int resCode = connection.getResponseCode();
      LOG.debug("Response code from master was: " + Integer.toString(resCode));

      connection.disconnect();
      return resCode == HttpURLConnection.HTTP_OK;
    } catch (MalformedURLException e) {
      LOG.error("Malformed URL in attempt to check if master is running already", e);
    } catch (IOException e) {
      LOG.debug("No existing master found", e);
    }

    return false;
  }
1303574
public boolean isActivelySynced(AlluxioURI path) {
    for (AlluxioURI syncedPath : mSyncPathList) {
      try {
        if (PathUtils.hasPrefix(path.getPath(), syncedPath.getPath())) {
          return true;
        }
      } catch (InvalidPathException e) {
        return false;
      }
    }
    return false;
  }
1312093
@Override
	public boolean isMachineRunning( TargetHandlerParameters parameters, String machineId )
	throws TargetException {

		boolean result = false;
		try {
			AmazonEC2 ec2 = createEc2Client( parameters.getTargetProperties());
			DescribeInstancesRequest dis = new DescribeInstancesRequest();
			dis.setInstanceIds(Collections.singletonList(machineId));

			DescribeInstancesResult disresult = ec2.describeInstances( dis );
			result = ! disresult.getReservations().isEmpty();

		} catch( AmazonServiceException e ) {
			// nothing, the instance does not exist

		} catch( AmazonClientException e ) {
			this.logger.severe( "An error occurred while checking whether a machine is running on Amazon EC2. " + e.getMessage());
			throw new TargetException( e );
		}

		return result;
	}
813699
def has_property(node_uri, property_name, ossos_base=True):
    
    if get_property(node_uri, property_name, ossos_base) is None:
        return False
    else:
        return True
300464
@Override
	public ESat isEntailed() {
		for (int i : loops.getLB()) {
			if (!g.getPotSuccOrNeighOf(i).contains(i)) {
				return ESat.FALSE;
			}
		}
		for (int i : g.getMandatoryNodes()) {
			if (g.getMandSuccOrNeighOf(i).contains(i) && !loops.getUB().contains(i)) {
				return ESat.FALSE;
			}
		}
		if (isCompletelyInstantiated()) {
			return ESat.TRUE;
		}
		return ESat.UNDEFINED;
	}
1248396
private void handleMasterNodeChange() {
    try {
      synchronized (hasActiveServer) {
        if (ZooKeeperUtil.watchAndCheckExists(this, masterZnode)) {
          // A master node exists, there is an active master
          if (LOG.isDebugEnabled()) {
            LOG.debug("A master is now available");
          }
          hasActiveServer.set(true);
        } else {
          // Node is no longer there, cluster does not have an active master
          if (LOG.isDebugEnabled()) {
            LOG.debug("No master available. Notifying waiting threads");
          }
          hasActiveServer.set(false);
          // Notify any thread waiting to become the active master
          hasActiveServer.notifyAll();
        }
      }
    } catch (KeeperException ke) {
      LOG.error("Received an unexpected KeeperException, aborting", ke);
    }
  }
905015
public boolean isLeaf()
    {
        NodeData data = (NodeData)this.getUserObject();
        if (data != null)
            return data.isLeaf();
        return false;
    }
1248879
private boolean existsOutdatedEntryOnPath(Node node) {
    	if (node == root){
    		node.makeOlder(timestamp, negLambda);
    		return node.getIrrelevantEntry(this.weightThreshold)!=null;
    	}
    	do{
    		node = node.getEntries()[0].getParentEntry().getNode();
    		node.makeOlder(timestamp, negLambda);
    		for (Entry e : node.getEntries()){
    			e.recalculateData();
    		}
    		if (node.numFreeEntries()>0)
    			return true;
    		if (node.getIrrelevantEntry(this.weightThreshold)!=null)
    			return true;
    	}while(node.getEntries()[0].getParentEntry()!=null);
		return false;
	}
1031813
public boolean isRunning(final ProcessorGraphNode processorGraphNode) {
        this.processorLock.lock();
        try {
            return this.runningProcessors.containsKey(processorGraphNode.getProcessor());
        } finally {
            this.processorLock.unlock();
        }
    }
876986
@Override
    public boolean hasOuterJoin() {
        assert(m_leftNode != null && m_rightNode != null);
        return m_joinType != JoinType.INNER ||
                m_leftNode.hasOuterJoin() || m_rightNode.hasOuterJoin();
    }
333620
def find_existing_master
      if data = @zk.get(redis_nodes_path).first
        nodes = symbolize_keys(decode(data))
        master = node_from(nodes[:master])
        logger.info("Master from existing znode config: #{master || 'none'}")
        # Check for case where a node previously thought to be the master was
        # somehow manually reconfigured to be a slave outside of the node manager's
        # control.
        begin
          if master && master.slave?
            raise InvalidNodeRoleError.new(master, :master, :slave)
          end
        rescue RedisFailover::NodeUnavailableError => ex
          logger.warn("Failed to check whether existing master has invalid role: #{ex.inspect}")
        end

        master
      end
    rescue ZK::Exceptions::NoNode
      # blank slate, no last known master
      nil
    end
1017447
def has_pending(self):
        
        if self.pending:
            return True
        for pending in self.node2pending.values():
            if pending:
                return True
        return False
1346062
@Override
    public boolean loadExisting() {
        if (!index.loadExisting())
            return false;

        if (index.getHeader(0) != MAGIC_INT)
            throw new IllegalStateException("incorrect loc2id index version");

        int lat = index.getHeader(1 * 4);
        int lon = index.getHeader(2 * 4);
        int checksum = index.getHeader(3 * 4);
        if (checksum != graph.getNodes())
            throw new IllegalStateException("index was created from a different graph with "
                    + checksum + ". Current nodes:" + graph.getNodes());

        initAlgo(lat, lon);
        return true;
    }
339979
def is_running(self):
        
        for node in self._nodes.values():
            # Some node type are always running we ignore them
            if node.status != "stopped" and not node.is_always_running():
                return True
        return False
225674
public boolean isEnabled()
    {
        if ((this.getMasterSlaveFlag() & FileListener.RUN_IN_SLAVE) == 0) // Is NOT enabled in a SERVER only environment
            if (this.getOwner() != null)
                if ((this.getOwner().getMasterSlave() & RecordOwner.MASTER) == 0) // Is not a client environment
            return false;   // Don't run this listener in a server-only environment
        if ((this.getMasterSlaveFlag() & FileListener.RUN_IN_MASTER) == 0) // Is NOT enabled in a CLIENT only environment
            if (this.getOwner() != null)
                if ((this.getOwner().getMasterSlave() & RecordOwner.SLAVE) == 0) // Is not a server environment
            return false;   // Don't run this listener in a client-only environment
        return super.isEnabled();
    }
262489
private boolean checkPartitionOwner() {
        InternalPartitionServiceImpl partitionService = getService();
        PartitionStateManager partitionStateManager = partitionService.getPartitionStateManager();
        InternalPartitionImpl partition = partitionStateManager.getPartitionImpl(getPartitionId());
        PartitionReplica owner = partition.getOwnerReplicaOrNull();

        NodeEngine nodeEngine = getNodeEngine();
        if (owner == null || !owner.isIdentical(nodeEngine.getLocalMember())) {
            ILogger logger = getLogger();
            if (logger.isFinestEnabled()) {
                logger.finest("This node is not owner partition. Cannot process request. partitionId="
                        + getPartitionId() + ", replicaIndex=" + getReplicaIndex() + ", namespaces=" + namespaces);
            }
            return false;
        }
        return true;
    }
799307
public boolean heartbeat(ClusterNodeInfo clusterNodeInfo)
    throws DisallowedNode {
    ClusterNode node = nameToNode.get(clusterNodeInfo.name);
    if (!canAllowNode(clusterNodeInfo.getAddress().getHost())) {
      if (node != null) {
        node.heartbeat(clusterNodeInfo);
      } else {
        throw new DisallowedNode(clusterNodeInfo.getAddress().getHost());
      }
      return false;
    }
    boolean newNode = false;
    Map<ResourceType, String> currentResources =
        clusterNodeInfo.getResourceInfos();
    if (currentResources == null) {
      currentResources = new EnumMap<ResourceType, String>(ResourceType.class);
    }

    if (node == null) {
      LOG.info("Adding node with heartbeat: " + clusterNodeInfo.toString());
      node = new ClusterNode(clusterNodeInfo,
          topologyCache.getNode(clusterNodeInfo.address.host),
          cpuToResourcePartitioning);
      addNode(node, currentResources);
      newNode = true;
    }

    node.heartbeat(clusterNodeInfo);

    boolean appsChanged = false;
    Map<ResourceType, String> prevResources =
        nameToApps.get(clusterNodeInfo.name);
    Set<ResourceType> deletedApps = null;
    for (Map.Entry<ResourceType, String> entry : prevResources.entrySet()) {
      String newAppInfo = currentResources.get(entry.getKey());
      String oldAppInfo = entry.getValue();
      if (newAppInfo == null || !newAppInfo.equals(oldAppInfo)) {
        if (deletedApps == null) {
          deletedApps = EnumSet.noneOf(ResourceType.class);
        }
        deletedApps.add(entry.getKey());
        appsChanged = true;
      }
    }
    Map<ResourceType, String> addedApps = null;
    for (Map.Entry<ResourceType, String> entry : currentResources.entrySet()) {
      String newAppInfo = entry.getValue();
      String oldAppInfo = prevResources.get(entry.getKey());
      if (oldAppInfo == null || !oldAppInfo.equals(newAppInfo)) {
        if (addedApps == null) {
          addedApps = new EnumMap<ResourceType, String>(ResourceType.class);
        }
        addedApps.put(entry.getKey(), entry.getValue());
        appsChanged = true;
      }
    }
    if (deletedApps != null) {
      for (ResourceType deleted : deletedApps) {
        clusterManager.nodeAppRemoved(clusterNodeInfo.name, deleted);
      }
    }
    if (addedApps != null) {
      for (Map.Entry<ResourceType, String> added: addedApps.entrySet()) {
        addAppToNode(node, added.getKey(), added.getValue());
      }
    }

    updateRunnability(node);
    return newNode || appsChanged;
  }