UIDService uidService = (UIDService) getServiceBroker().getService(this, UIDService.class, null); HealthMonitorRequest hmr = new HealthMonitorRequestImpl(agentId, communityName, HealthMonitorRequest.RESTART, new String[]{agentName}, origNode, destNode, uidService.nextUID()); RelayAdapter hmrRa = new RelayAdapter(agentId, hmr, hmr.getUID()); hmrRa.addTarget(SimpleMessageAddress.getSimpleMessageAddress(destNode)); if (logger.isDebugEnabled()) { logger.debug("Publishing HealthMonitorRequest:" + " request=" + hmr.getRequestTypeAsString() + " targets=" + targetsToString(hmrRa.getTargets()) + " community-" + hmr.getCommunityName() + " agents=" + arrayToString(hmr.getAgents()) + " destNode=" + hmr.getDestinationNode()); } blackboard.publishAdd(hmrRa);
remoteRestartRequestQueue.add(new RemoteRestartRequest(agentName, origNode, destNode, communityName));
  public void restartAgent(String agentName,                           String origNode,                           String destNode,                           String communityName) {    logger.debug("RestartAgent:" +                " destNode=" + destNode +                " agent=" + agentName);    if (agentId.toString().equals(destNode)) {      // Restart locally      restartAgent(agentName);    } else {      // Forward request to remote agent      UIDService uidService = (UIDService) getServiceBroker().getService(this, UIDService.class, null);      HealthMonitorRequest hmr =          new HealthMonitorRequestImpl(agentId,          communityName,          HealthMonitorRequest.RESTART,          new String[]{agentName},          origNode,          destNode,          uidService.nextUID());      RelayAdapter hmrRa = new RelayAdapter(agentId, hmr, hmr.getUID());      hmrRa.addTarget(SimpleMessageAddress.getSimpleMessageAddress(destNode));      if (logger.isDebugEnabled()) {        logger.debug("Publishing HealthMonitorRequest:" +                    " request=" + hmr.getRequestTypeAsString() +                    " targets=" + targetsToString(hmrRa.getTargets()) +                    " community-" + hmr.getCommunityName() +                    " agents=" +                    arrayToString(hmr.getAgents()) +                    " destNode=" + hmr.getDestinationNode());      }      blackboard.publishAdd(hmrRa);    }  }