check whether the topology is bActive?

@throws Exception
352842
public void checkTopologyActive(NimbusData nimbus, String topologyName, boolean bActive) throws Exception {
        if (isTopologyActive(nimbus.getStormClusterState(), topologyName) != bActive) {
            if (bActive) {
                throw new NotAliveException(topologyName + " is not alive");
            } else {
                throw new AlreadyAliveException(topologyName + " is already alive");
            }
        }
    }
936889
function(topology) {
  const maxWireVersion = topology.lastIsMaster().maxWireVersion;
  if (maxWireVersion < RETRYABLE_WIRE_VERSION) {
    return false;
  }

  if (!topology.logicalSessionTimeoutMinutes) {
    return false;
  }

  if (topologyType(topology) === TopologyType.Single) {
    return false;
  }

  return true;
}
343915
private boolean isSymlink(File base, Vector pathElements) {
        if (pathElements.size() > 0) {
            String current = (String) pathElements.remove(0);
            try {
                return FileUtil.isSymbolicLink(base, current)
                    || isSymlink(new File(base, current), pathElements);
            } catch (IOException ioe) {
                String msg = "IOException caught while checking "
                    + "for links, couldn't get canonical path!";
                // will be caught and redirected to Ant's logging system
                System.err.println(msg);
            }
        }
        return false;
    }
703014
public static void validate_basic(StormTopology topology, Map<Object, Object> totalStormConf,
                                      String topologyId) throws InvalidTopologyException {
        validate_ids(topology, topologyId);

        for (StormTopology._Fields field : Thrift.SPOUT_FIELDS) {
            Object value = topology.getFieldValue(field);
            if (value != null) {
                Map<String, Object> obj_map = (Map<String, Object>) value;
                for (Object obj : obj_map.values()) {
                    validate_component_inputs(obj);
                }
            }
        }

        Integer workerNum = JStormUtils.parseInt(totalStormConf.get(Config.TOPOLOGY_WORKERS));
        if (workerNum == null || workerNum <= 0) {
            String errMsg = "There is no Config.TOPOLOGY_WORKERS in configuration of " + topologyId;
            throw new InvalidParameterException(errMsg);
        }

        Integer ackerNum = JStormUtils.parseInt(totalStormConf.get(Config.TOPOLOGY_ACKER_EXECUTORS));
        if (ackerNum != null && ackerNum < 0) {
            String errMsg = "Invalid Config.TOPOLOGY_ACKERS in configuration of " + topologyId;
            throw new InvalidParameterException(errMsg);
        }

    }
436825
function isAbsolute()
    {
        $p = $this->getPath();

        reset($p);
        $fi = current($p);
        return $this->_isRoot($fi);
    }
836120
@Override
    public void run() {
        StormClusterState clusterState = data.getStormClusterState();

        try {
            // Note: need first check Assignments
            List<String> activeTopologies = clusterState.assignments(null);

            if (activeTopologies == null) {
                LOG.info("Failed to get active topologies");
                return;
            }

            for (String topologyId : activeTopologies) {
                if (clusterState.storm_base(topologyId, null) == null) {
                    continue;
                }

                LOG.debug("Check tasks of topology " + topologyId);

                // Note that we don't check /ZK-dir/taskbeats/topologyId to get task ids
                Set<Integer> taskIds = clusterState.task_ids(topologyId);
                if (taskIds == null) {
                    LOG.info("Failed to get task ids of " + topologyId);
                    continue;
                }
                Assignment assignment = clusterState.assignment_info(topologyId, null);

                Set<Integer> deadTasks = new HashSet<>();
                boolean needReassign = false;
                for (Integer task : taskIds) {
                    boolean isTaskDead = NimbusUtils.isTaskDead(data, topologyId, task);
                    if (isTaskDead) {
                        deadTasks.add(task);
                        needReassign = true;
                    }
                }

                TopologyTaskHbInfo topologyHbInfo = data.getTasksHeartbeat().get(topologyId);
                if (needReassign) {
                    if (topologyHbInfo != null) {
                        int topologyMasterId = topologyHbInfo.get_topologyMasterId();
                        if (deadTasks.contains(topologyMasterId)) {
                            deadTasks.clear();
                            if (assignment != null) {
                                ResourceWorkerSlot resource = assignment.getWorkerByTaskId(topologyMasterId);
                                if (resource != null)
                                    deadTasks.addAll(resource.getTasks());
                                else
                                    deadTasks.add(topologyMasterId);
                            }
                        } else {
                            Map<Integer, TaskHeartbeat> taskHbs = topologyHbInfo.get_taskHbs();
                            int launchTime = JStormUtils.parseInt(data.getConf().get(Config.NIMBUS_TASK_LAUNCH_SECS));
                            if (taskHbs == null || taskHbs.get(topologyMasterId) == null ||
                                    taskHbs.get(topologyMasterId).get_uptime() < launchTime) {
                                /*try {
                                    clusterState.topology_heartbeat(topologyId, topologyHbInfo);
                                } catch (Exception e) {
                                    LOG.error("Failed to update task heartbeat info to ZK for " + topologyId, e);
                                }*/
                                return;
                            }
                        }
                        Map<Integer, ResourceWorkerSlot> deadTaskWorkers = new HashMap<>();
                        for (Integer task : deadTasks) {
                            LOG.info("Found " + topologyId + ", taskId:" + task + " is dead");

                            ResourceWorkerSlot resource = null;
                            if (assignment != null)
                                resource = assignment.getWorkerByTaskId(task);
                            if (resource != null) {
                                deadTaskWorkers.put(task, resource);
                            }
                        }
                        Map<ResourceWorkerSlot, List<Integer>> workersDeadTasks = JStormUtils.reverse_map(deadTaskWorkers);
                        for (Map.Entry<ResourceWorkerSlot, List<Integer>> entry : workersDeadTasks.entrySet()) {
                            ResourceWorkerSlot resource = entry.getKey();
                            //we only report one task
                            for (Integer task : entry.getValue()) {
                                Date now = new Date();
                                String nowStr = TimeFormat.getSecond(now);
                                String errorInfo = "Task-" + entry.getValue().toString() + " is dead on " +
                                        resource.getHostname() + ":" + resource.getPort() + ", " + nowStr;
                                LOG.info(errorInfo);
                                clusterState.report_task_error(topologyId, task, errorInfo, ErrorConstants.ERROR,
                                        ErrorConstants.CODE_TASK_DEAD, ErrorConstants.DURATION_SECS_TASK_DEAD);
                                break;
                            }
                        }
                        if (deadTaskWorkers.size() > 0) {
                            // notify jstorm monitor
                            TaskDeadEvent.pushEvent(topologyId, deadTaskWorkers);
                        }
                    }
                    NimbusUtils.transition(data, topologyId, false, StatusType.monitor);
                }

                if (topologyHbInfo != null) {
                    try {
                        clusterState.topology_heartbeat(topologyId, topologyHbInfo);
                    } catch (Exception e) {
                        LOG.error("Failed to update task heartbeat info to ZK for " + topologyId, e);
                    }
                }
            }

        } catch (Exception e) {
            LOG.error(e.getMessage(), e);
        }
    }
965073
public Boolean setTopology(TopologyAPI.Topology topology, String topologyName) {
    return awaitResult(delegate.setTopology(topology, topologyName));
  }
1231831
public function hasDataToRead()
    {
        if (!$this->isConnected()) {
            throw new ConnectionException('Not connected to any server.', $this->activeHost);
        }

        $isDataInBuffer = $this->connectionHasDataToRead($this->readTimeout[0], $this->readTimeout[1]);
        if (!$isDataInBuffer) {
            $this->observers->emptyBuffer();
        }
        return $isDataInBuffer;
    }
525393
public boolean isActive()
    {
        FacesContext facesContext = FacesContext.getCurrentInstance();
        if (facesContext != null)
        {
            return facesContext.getViewRoot() != null;
        }
        else
        {
            // No FacesContext means no view scope active.
            return false;
        }
    }
1099291
protected function checkParam()
    {
        if (empty($this->getHost()) && empty($this->getUnixSocket())) {
            $sErrorMessage = 'Connexion to Mysql must have an host or an unix socket defined';
            throw new \Exception($sErrorMessage);
            return false;
        } else {
            return true;
        }
    }
1003872
def has_map(self):
        """"""
        if not self._ptr:
            raise BfdException("BFD not initialized")

        return _bfd.get_bfd_attribute(self._ptr, BfdAttributes.HAS_MAP)
838658
public boolean isActive() throws BuildException {
    final Project p = getProject();
    if (p == null) {
      throw new java.lang.IllegalStateException("setProject() should have been called");
    }
    return CUtil.isActive(p, this.ifCond, this.unlessCond);
  }
225044
@Override
  public boolean doBuild(TopologyBuilder bldr, Set<String> stageNames) {
    // Create and set bolt
    BoltDeclarer declarer;
    if (operator instanceof IStreamletBasicOperator) {
      setDefaultNameIfNone(StreamletNamePrefix.CUSTOM, stageNames);
      IStreamletBasicOperator<R, T> op = (IStreamletBasicOperator<R, T>) operator;
      bldr.setBolt(getName(), op,  getNumPartitions())
          .grouping(parent.getName(), parent.getStreamId(), grouper);
    } else if (operator instanceof IStreamletRichOperator) {
      setDefaultNameIfNone(StreamletNamePrefix.CUSTOM_BASIC, stageNames);
      IStreamletRichOperator<R, T> op = (IStreamletRichOperator<R, T>) operator;
      bldr.setBolt(getName(), op,  getNumPartitions())
          .grouping(parent.getName(), parent.getStreamId(), grouper);
    } else if (operator instanceof IStreamletWindowOperator) {
      setDefaultNameIfNone(StreamletNamePrefix.CUSTOM_WINDOW, stageNames);
      IStreamletWindowOperator<R, T> op = (IStreamletWindowOperator<R, T>) operator;
      bldr.setBolt(getName(), op,  getNumPartitions())
          .grouping(parent.getName(), parent.getStreamId(), grouper);
    } else {
      throw new RuntimeException("Unhandled operator class is found!");
    }

    return true;
  }
750416
@Override
    public boolean isActive() {
        if (tc.isEntryEnabled())
            Tr.entry(tc, "isActive", this);

        boolean isActive = false;

        try {
            switch (ut.getStatus()) {
                case Status.STATUS_ACTIVE:
                case Status.STATUS_MARKED_ROLLBACK:
                case Status.STATUS_PREPARED:
                case Status.STATUS_UNKNOWN:
                case Status.STATUS_PREPARING:
                case Status.STATUS_COMMITTING:
                case Status.STATUS_ROLLING_BACK:
                    isActive = true;
                    break;
                default:
                    isActive = false;
            }
        } catch (Exception e) {
            // drop through
        }

        if (tc.isEntryEnabled())
            Tr.exit(tc, "isActive", isActive);

        return isActive;
    }
504522
public function IsActive()
    {
        $bIsActive = $this->GetFromInternalCache('bIsActive');
        if (null === $bIsActive) {
            $bIsActive = parent::IsActive();
            if ($bIsActive) {
                // wrapping only if wrapping is set
                $bIsActive = false;
                $oWrapping = TdbShopWrappingList::GetList();
                if ($oWrapping->Length() > 0) {
                    $bIsActive = true;
                }
                if (false == $bIsActive) {
                    $oCards = TdbShopWrappingCardList::GetList();
                    if ($oCards->Length() > 0) {
                        $bIsActive = true;
                    }
                }
            }
            $this->SetInternalCache('bIsActive', $bIsActive);
        }

        return $bIsActive;
    }
1116742
@PostConstruct
    public void init() throws Exception {

        if (hosts == null) {
            throw new IllegalArgumentException("Hosts property not set ");
        }

        determineHostsAsProperty();

        /**
         * quick fix for integration tests. if hosts property set to "embedded" then a local node is start.
         * maven dependencies need to be defined correctly for this to work
         */

        if (hosts.startsWith("embedded")) {
            synchronized (SYNC) {
                if (node == null) {
                    node = new ElasticsearchEmbeddedNode();
                }
            }
            client = node.getClient();
        } else {
            String[] hostsArray = hosts.split(",");
            Settings settings = ImmutableSettings.settingsBuilder().put("cluster.name", cluster).build();
            client = new TransportClient(settings);

            for (String aHostsArray : hostsArray) {
                String s = aHostsArray.trim();
                String[] host = s.split(":");

                if (log.isLoggable(Level.FINE)) {
                    log.fine(" Connecting to elasticsearch host. [" + host[0] + ":" + host[1] + "]");
                }

                client = ((TransportClient)client).addTransportAddress(new InetSocketTransportAddress(host[0],
                        new Integer(host[1])));
            }
        }
    }
45340
private static boolean isAdaptiveException(Throwable t) {
        if (t instanceof FrameTooLongException) {
            return true;
        }

        if (t instanceof NoHostAvailableException) {
            // If the issue on every host is adaptive then the exception is adaptive
            Collection<Throwable> hostExceptions = ((NoHostAvailableException) t).getErrors().values();
            return !hostExceptions.isEmpty() && hostExceptions.stream().allMatch(AdaptiveResultSet::isAdaptiveException);
        }

        return false;
    }