final MessageAddress agent = SimpleMessageAddress.getSimpleMessageAddress( (String)
MessageAddress agentToRestart = SimpleMessageAddress.getSimpleMessageAddress((String)
  private void restartNext() {    synchronized (restartsInProcess) {      removeExpiredRestarts();      if ( (!restartQueue.isEmpty()) &&          (restartsInProcess.size() <= MAX_CONCURRENT_RESTARTS)) {        logger.debug("RestartNext: " +                     " RestartQueue=" + restartQueue.size() +                     " restartsInProcess=" + restartsInProcess.size());        final MessageAddress agent =            SimpleMessageAddress.getSimpleMessageAddress( (String)            restartQueue.remove(0));        Long restartExpiration = new Long(now() + RESTART_TIMEOUT);        restartsInProcess.put(agent, restartExpiration);        try {          Object ticketId = mobilityFactory.createTicketIdentifier();          AddTicket addTicket = new AddTicket(ticketId, agent, agentId);          UID acUID = uidService.nextUID();          myUIDs.add(acUID);          AgentControl ac =              mobilityFactory.createAgentControl(acUID, agentId, addTicket);          restartInitiated(agent, agentId);          //event("Restarting agent: agent=" + agent + " dest=" + agentId);          blackboard.publishAdd(ac);          if (logger.isInfoEnabled()) {            StringBuffer sb =                new StringBuffer("Publishing AgentControl:" +                                 " myUid=" + myUIDs.contains(ac.getOwnerUID()) +                                 " status=" + ac.getStatusCodeAsString());            if (ac.getAbstractTicket()instanceof AddTicket) {              AddTicket at = (AddTicket) ac.getAbstractTicket();              sb.append(" agent=" + at.getMobileAgent() +                        " destNode=" + at.getDestinationNode());            }            logger.debug(sb.toString());          }        }        catch (Exception ex) {          logger.error("Exception in agent restart", ex);        }      }    }  }