Examples of Host


Examples of lcmc.host.domain.Host

    @Inject
    private WidgetFactory widgetFactory;
    private MyButton resolveButton;

    protected void resolve() {
        final Host h1 = getDrbdVolumeInfo().getFirstBlockDevInfo().getHost();
        final Host h2 = getDrbdVolumeInfo().getSecondBlockDevInfo().getHost();
        final String h = hostWithBetterDataWidget.getStringValue();

        final Runnable runnable = new Runnable() {
            @Override
            public void run() {
                final Host hostPri;
                final Host hostSec;
                if (h.equals(h1.getName())) {
                    hostPri = h1;
                    hostSec = h2;
                } else if (h.equals(h2.getName())) {
                    hostPri = h2;
View Full Code Here

Examples of net.gridshield.nexsm.entityclasses.Host

        public void refreshInfo(Vertex v) {
            clearLabels();
            rmaxwitdh = 0;
            vselected = v;
            sip.showServices(v);
            Host h = _gm.getVertexHost(vselected);
            HostStatus hs = _gm.getVertexHostStatus(vselected);
            JLabel tmp = null;
            Font f = null;
            FontMetrics fm = null;
            tmp = labelsRight.get(labelsTexts[0]);
            f = tmp.getFont();
            fm = tmp.getFontMetrics(f);
            if (h != null) {
                tmp.setText(h.getName());
                tmp.setToolTipText(tmp.getText());
                tmp = labelsRight.get(labelsTexts[1]);
                tmp.setText(h.getDescription());
                tmp.setToolTipText(tmp.getText());
                tmp = labelsRight.get(labelsTexts[2]);
                tmp.setText(h.getAddress());
                tmp.setToolTipText(tmp.getText());
                tmp = labelsRight.get(labelsTexts[3]);
                tmp.setText(h.getParentsString());
            }
            if (hs != null) {
                tmp.setToolTipText(tmp.getText());
                tmp = labelsRight.get(labelsTexts[4]); // status info
                tmp.setText(hs.getPluginOutput());
                tmp.setToolTipText(tmp.getText());
                // ^^^^^ status info
               
                tmp = labelsRight.get(labelsTexts[5]); // current state
                String currState = hs.getCurrentState().toString();
                setFontColor(tmp, hs.getCurrentState(), hs.getProblemHasBeenAcknowledged());
                tmp.setText(currState + hasBeenAcknowledged(hs.getProblemHasBeenAcknowledged(), hs.getCurrentState()));
                tmp.setToolTipText(tmp.getText());
               
                // Last check
                tmp = labelsRight.get(labelsTexts[6]);
                long time = hs.getLastCheck();
                if (time != 0) {
                    tmp.setText(DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.SHORT).format(time));
                } else {
                    tmp.setText("N/A");
                }
                tmp.setToolTipText(tmp.getText());

                // time in actual state
                tmp = labelsRight.get(labelsTexts[7]);
                tmp.setText(timeInActualState(System.currentTimeMillis() -  hs.getLastStateChange()) + (hs.getLastStateChange() == 0?"+":""));
                tmp.setToolTipText(tmp.getText());

                tmp = labelsRight.get(labelsTexts[8])//previous hard state
                setFontColor(tmp, hs.getLastHardState());
                tmp.setText(hs.getLastHardState().toString());

                tmp = labelsRight.get(labelsTexts[9]);
                time = hs.getLastHardStateChange();
                if (time != 0) {
                    tmp.setText(DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.SHORT).format(hs.getLastHardStateChange()));   
                } else {
                    tmp.setText("N/A");
                }
                tmp.setToolTipText(tmp.getText());

                time = 0;
                time = hs.getLastTimeUp();
                tmp = labelsRight.get(labelsTexts[10]);
                if (time != 0) {
                    tmp.setText(DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.SHORT).format(hs.getLastTimeUp()));
                } else {
                    tmp.setText("N/A");
                }
                tmp.setToolTipText(tmp.getText());

                time = 0;
                time = hs.getLastTimeDown();
                tmp = labelsRight.get(labelsTexts[11]);
                if (time != 0) {
                    tmp.setText(DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.SHORT).format(hs.getLastTimeDown()));
                } else {
                    tmp.setText("N/A");
                }
                tmp.setToolTipText(tmp.getText());

                tmp = labelsRight.get(labelsTexts[12]);
                time = 0;
                time = hs.getLastTimeUnreachable();
                if (time != 0) {
                    tmp.setText(DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.SHORT).format(hs.getLastTimeUnreachable()));
                } else {
                    tmp.setText("N/A");
                }
                tmp.setToolTipText(tmp.getText());

                // check host to only show services links it has
                tmp = labelsInfo.get(16);
               
                if (_gm.getHostExtInfo(h.getName()) != null &&
                        _gm.getHostExtInfo(h.getName()).getNotesUrl().length() == 0) {
                    tmp.setEnabled(false);
                } else {
                    tmp.setEnabled(true);
                }
View Full Code Here

Examples of net.jini.lookup.entry.Host

                logger.trace("Already have {}, service count now {}", item, serviceList.size());
            }
        }
        int ndx = -1;
        if (hostAddress != null) {
            Host host = getHostEntry(item);
            if (host != null) {
                if (hostAddress.equals(host.hostName)) {
                    for (ServiceItem si : serviceList) {
                        Host h = getHostEntry(si);
                        if (h == null) {
                            ndx = serviceList.indexOf(si);
                            break;
                        } else if (h.hostName == null) {
                            ndx = serviceList.indexOf(si);
View Full Code Here

Examples of net.sf.agentopia.platform.net.Host

     *
     * @param port The port on which to start the server.
     */
    public void startHost(int port) {
        // Activate host.
        host = new Host(port);
        host.getMarketPlace().getClassedObjectTransmitter().setAllowNet(true);
        host.start();

        // The host will never be shut down by regular means.
        // Therefore, listen to SIGUP.
View Full Code Here

Examples of net.vo.Host

                // 整理信息
                byte[] buf = new byte[broadPacket.getLength()];
                System.arraycopy(broadPacket.getData(), 0, buf, 0, buf.length);
                byteArrayStram = new ByteArrayInputStream(buf);
                objectStream = new ObjectInputStream(byteArrayStram);
                Host host = (Host) objectStream.readObject();
                host.setState(0);

                if (!host.getIp().equals(SystemConf.hostIP)) {
                    if (!NetDomain.containHost(host)) {
                        host.setState(1);
                        NetDomain.addHost(host);
                        System.out.println(SystemConf.hostList.size());

                        // 回应广播, 发送本机信息去目标地址
                        if (host.getTag() == 0) {
                            InetAddress addr = InetAddress.getLocalHost();
                            String hostName = addr.getHostName();// 获取主机名
                            String ip = SystemConf.hostIP;// 获取ip地址

                            Map<String, String> map = System.getenv();
                            String userName = map.get("USERNAME");// 获取用户名
                            String userDomain = map.get("USERDOMAIN");// 获取计算机域

                            // 广播主机信息
                            Host res = new Host(userName, userDomain, ip,
                                    hostName, 1, 1);

                            NetDomain.sendUdpData(broadSocket, res,
                                    host.getIp(), SystemConf.broadcastPort);
                        }
View Full Code Here

Examples of network.Host

        frame.setContentPane(panel);
        frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
        panel.reloadComboOptions();
       
        // Seleccionar el hostName indicado por parametro
        Host host = Host.findHost(hostName);
        if (host != null)
            panel.getHostComboBox().setSelectedItem(host);
       
        panel.setImg(ClipboardManager.getClipboard());
        if (panel.getImg()==null)
View Full Code Here

Examples of org.apache.ambari.server.state.Host

   
    Cluster cluster = clusters.getCluster("c1");
    cluster.setDesiredStackVersion(new StackId("HDP-2.0.5"));
   
    clusters.addHost("h1");
    Host host = clusters.getHost("h1");
    host.setOsType("centos5");
    host.persist();
   
    clusters.mapHostToCluster("h1", "c1");
  }
View Full Code Here

Examples of org.apache.ambari.server.state.Host

    }

    response = new HeartBeatResponse();
    response.setResponseId(++currentResponseId);

    Host hostObject = clusterFsm.getHost(hostname);

    if (hostObject.getState().equals(HostState.HEARTBEAT_LOST)) {
      // After loosing heartbeat agent should reregister
      LOG.warn("Host is in HEARTBEAT_LOST state - sending register command");
      return createRegisterCommand();
    }

    hostResponseIds.put(hostname, currentResponseId);
    hostResponses.put(hostname, response);

    // If the host is waiting for component status updates, notify it
    if (heartbeat.componentStatus.size() > 0
        && hostObject.getState().equals(HostState.WAITING_FOR_HOST_STATUS_UPDATES)) {
      try {
        LOG.debug("Got component status updates");
        hostObject.handleEvent(new HostStatusUpdatesReceivedEvent(hostname, now));
      } catch (InvalidStateTransitionException e) {
        LOG.warn("Failed to notify the host about component status updates", e);
      }
    }

    try {
      if (heartbeat.getNodeStatus().getStatus().equals(HostStatus.Status.HEALTHY)) {
        hostObject.handleEvent(new HostHealthyHeartbeatEvent(hostname, now,
            heartbeat.getAgentEnv(), heartbeat.getMounts()));
      } else {
        hostObject.handleEvent(new HostUnhealthyHeartbeatEvent(hostname, now,
            null));
      }
    } catch (InvalidStateTransitionException ex) {
      LOG.warn("Asking agent to reregister due to " + ex.getMessage(), ex);
      hostObject.setState(HostState.INIT);
      return createRegisterCommand();
    }

    //Examine heartbeat for command reports
    processCommandReports(heartbeat, hostname, clusterFsm, now);

    // Examine heartbeart for component live status reports
    processStatusReports(heartbeat, hostname, clusterFsm);
   
    // Calculate host status
    // NOTE: This step must be after processing command/status reports
    processHostStatus(heartbeat, hostname);

    // Send commands if node is active
    if (hostObject.getState().equals(HostState.HEALTHY)) {
      sendCommands(hostname, response);
      annotateResponse(hostname, response);
    }   
    return response;
  }
View Full Code Here

Examples of org.apache.ambari.server.state.Host

    return response;
  }

  protected void processHostStatus(HeartBeat heartbeat, String hostname) throws AmbariException {

    Host host = clusterFsm.getHost(hostname);
    HealthStatus healthStatus = host.getHealthStatus().getHealthStatus();

    if (!healthStatus.equals(HostHealthStatus.HealthStatus.UNKNOWN)) {

      List<ComponentStatus> componentStatuses = heartbeat.getComponentStatus();
      //Host status info could be calculated only if agent returned statuses in heartbeat
      //Or, if a command is executed that can change component status
      boolean calculateHostStatus = false;
      String clusterName = null;
      if (componentStatuses.size() > 0) {
        calculateHostStatus = true;
        for (ComponentStatus componentStatus : componentStatuses) {
          clusterName = componentStatus.getClusterName();
          break;
        }
      }

      if (!calculateHostStatus) {
        List<CommandReport> reports = heartbeat.getReports();
        for (CommandReport report : reports) {
          if (RoleCommand.ACTIONEXECUTE.toString().equals(report.getRoleCommand())) {
            continue;
          }

          String service = report.getServiceName();
          if (actionMetadata.getActions(service.toLowerCase()).contains(report.getRole())) {
            continue;
          }
          if (report.getStatus().equals("COMPLETED")) {
            calculateHostStatus = true;
            clusterName = report.getClusterName();
            break;
          }
        }
      }

      if (calculateHostStatus) {
        //Use actual component status to compute the host status
        int masterCount = 0;
        int mastersRunning = 0;
        int slaveCount = 0;
        int slavesRunning = 0;

        StackId stackId;
        Cluster cluster = clusterFsm.getCluster(clusterName);
        stackId = cluster.getDesiredStackVersion();
       
        MaintenanceStateHelper psh = injector.getInstance(MaintenanceStateHelper.class);

        List<ServiceComponentHost> scHosts = cluster.getServiceComponentHosts(heartbeat.getHostname());
        for (ServiceComponentHost scHost : scHosts) {
          ComponentInfo componentInfo =
              ambariMetaInfo.getComponent(stackId.getStackName(),
                  stackId.getStackVersion(), scHost.getServiceName(),
                  scHost.getServiceComponentName());

          String status = scHost.getState().name();

          String category = componentInfo.getCategory();

          if (MaintenanceState.OFF == psh.getEffectiveState(scHost, host)) {
            if (category.equals("MASTER")) {
              ++masterCount;
              if (status.equals("STARTED")) {
                ++mastersRunning;
              }
            } else if (category.equals("SLAVE")) {
              ++slaveCount;
              if (status.equals("STARTED")) {
                ++slavesRunning;
              }
            }
          }
        }

        if (masterCount == mastersRunning && slaveCount == slavesRunning) {
          healthStatus = HostHealthStatus.HealthStatus.HEALTHY;
        } else if (masterCount > 0 && mastersRunning < masterCount) {
          healthStatus = HostHealthStatus.HealthStatus.UNHEALTHY;
        } else {
          healthStatus = HostHealthStatus.HealthStatus.ALERT;
        }

        host.setStatus(healthStatus.name());
        host.persist();
      }

      //If host doesn't belongs to any cluster
      if ((clusterFsm.getClustersForHost(host.getHostName())).size() == 0) {
        healthStatus = HostHealthStatus.HealthStatus.HEALTHY;
        host.setStatus(healthStatus.name());
        host.persist();
      }
    }
  }
View Full Code Here

Examples of org.apache.ambari.server.state.Host

          + ", hostname=" + hostname
          + ", serverOsType=" + config.getServerOsType()
          + ", agentOstype=" + agentOsType);
    }

    Host hostObject;
    try {
      hostObject = clusterFsm.getHost(hostname);
    } catch (HostNotFoundException ex) {
      clusterFsm.addHost(hostname);
      hostObject = clusterFsm.getHost(hostname);
    }
    // Resetting host state
    hostObject.setState(HostState.INIT);

    // Set ping port for agent
    hostObject.setCurrentPingPort(currentPingPort);

    // Get status of service components
    List<StatusCommand> cmds = heartbeatMonitor.generateStatusCommands(hostname);

    hostObject.handleEvent(new HostRegistrationRequestEvent(hostname,
        null != register.getPublicHostname() ? register.getPublicHostname() : hostname,
        new AgentVersion(register.getAgentVersion()), now, register.getHardwareProfile(),
        register.getAgentEnv()));
    RegistrationResponse response = new RegistrationResponse();
    if (cmds.isEmpty()) {
      //No status commands needed let the fsm know that status step is done
      hostObject.handleEvent(new HostStatusUpdatesReceivedEvent(hostname,
          now));
    }
    response.setStatusCommands(cmds);

    response.setResponseStatus(RegistrationStatus.OK);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.