Package jade.core

Examples of jade.core.Node


 
  private void checkNode(String name, byte[] nn, String oldAddress, String currentAddress) {
    if (myLogger.isLoggable(Logger.FINE)) {
      myLogger.log(Logger.FINE, "Recovering node "+name+" ...");
    }
    Node node = null;
    try {
      node = nodeSerializer.deserialize(nn);
      node.platformManagerDead(oldAddress, currentAddress);
      myLogger.log(Logger.INFO, "Node "+name+" successfully recovered.");
      return;
    }
    catch (IMTPException imtpe) {
      myLogger.log(Logger.INFO, "Node "+name+" unreachable. It has likely been killed in the meanwhile");
    }
    catch (Exception e) {
      myLogger.log(Logger.WARNING, "Error deserializing node "+name+". ", e);
    }
    // If we get here the node either has been killed in the meanwhile or cannot be deserialized -->
    // In any case remove it from the PS
    try {
      myPS.removeNode(node.getName());
    }
    catch (Exception ex) {
      myLogger.log(Logger.WARNING, "Cannot remove node "+node.getName()+" from persistent storage. ", ex);
    }
  }
View Full Code Here


      myLogger.log(Logger.WARNING, "Cannot remove node "+node.getName()+" from persistent storage. ", ex);
    }
  }
   
  private void killNode(String name, byte[] nn) {
    Node node = null;
    try {
      node = nodeSerializer.deserialize(nn);
      HorizontalCommand cmd = new GenericCommand(H_KILLNODE, NAME, null);
      node.accept(cmd);
      myLogger.log(Logger.INFO, "Node "+name+" successfully killed.");
    }
    catch (IMTPException imtpe) {
      myLogger.log(Logger.INFO, "Node "+name+" unreachable (it has likely been killed in the meanwhile) or does not support fault recovery.");
    }
    catch (Exception e) {
      myLogger.log(Logger.WARNING, "Error deserializing node "+name+". ", e);
    }
    // In any case remove the node from the PS
    try {
      myPS.removeNode(node.getName());
    }
    catch (Exception ex) {
      myLogger.log(Logger.WARNING, "Cannot remove node "+node.getName()+" from persistent storage. ", ex);
    }
  }
View Full Code Here

 
  /**
   Add a newly born node to the persistent storage
   */
  private void handleNewNode(NodeDescriptor dsc) throws Exception {
    Node node = dsc.getNode();
    if (!node.hasPlatformManager()) {
      byte[] nn = nodeSerializer.serialize(node);
      myPS.storeNode(node.getName(), (dsc.getParentNode() != null), nn);     
      myLogger.log(Logger.FINE, "Node "+node.getName()+" added to persistent storage.");
    }
  }
View Full Code Here

 
  /**
   Remove a dead node from the persistent storage
   */
  private void handleDeadNode(NodeDescriptor dsc) throws Exception {
    Node node = dsc.getNode();
    if (!node.hasPlatformManager()) {
      myPS.removeNode(node.getName());     
      myLogger.log(Logger.FINE, "Node "+node.getName()+" removed from persistent storage.");
    }
  }
View Full Code Here

    cmd.addParam(host);
    cmd.addParam(new Integer(port));
    cmd.addParam(new Integer(pingDelay));
    cmd.addParam(new Long(key));

    Node n = getNode();
    Object result = n.accept(cmd);
    if ((result != null) && (result instanceof Throwable)) {
      if (result instanceof IMTPException) {
        throw (IMTPException) result;
      }
      else {
View Full Code Here

    try {
      GenericCommand cmd = new GenericCommand(H_DEACTIVATEUDP, UDPNodeMonitoringService.NAME, null);
      cmd.addParam(label);
      cmd.addParam(new Long(key));
 
      Node n = getNode();
      Object result = n.accept(cmd);
      if ((result != null) && (result instanceof Throwable)) {
        if (result instanceof IMTPException) {
          throw (IMTPException) result;
        }
        else {
View Full Code Here

      impl.bornAgent(agentID, cid, principal, ownership, forceReplacement);
    }
    catch(NameClashException nce) {
      try {
        ContainerID oldCid = impl.getContainerID(agentID);
        Node n = impl.getContainerNode(oldCid).getNode();
       
        // Perform a non-blocking ping to check...
        n.ping(false);
       
        // Ping succeeded: rethrow the NameClashException
        throw nce;
      }
      catch(NameClashException nce2) {
View Full Code Here

        cmd.addParam(new Long(timeStamp));
      }     
      cmd.setPrincipal(msg.getSenderPrincipal());
      cmd.setCredentials(msg.getSenderCredentials());
     
      Node n = getNode();
      Object result = n.accept(cmd);
      if((result != null) && (result instanceof Throwable)) {
        if(result instanceof IMTPException) {
          throw (IMTPException)result;
        }
        else if(result instanceof NotFoundException) {
View Full Code Here

      cmd.addParam(payload);
      cmd.addParam(receiverID);
      cmd.addParam(address);
     
     
      Node n = getNode();
      Object result = n.accept(cmd);
      if((result != null) && (result instanceof Throwable)) {
        if(result instanceof IMTPException) {
          throw (IMTPException)result;
        }
        else if(result instanceof MTPException) {
View Full Code Here

    try {
      GenericCommand cmd = new GenericCommand(H_GETAGENTLOCATION, NAME, null);
      cmd.addParam(agentID);
     
     
      Node n = getNode();
      Object result = n.accept(cmd);
      if((result != null) && (result instanceof Throwable)) {
        if(result instanceof IMTPException) {
          throw (IMTPException)result;
        }
        else if(result instanceof NotFoundException) {
View Full Code Here

TOP

Related Classes of jade.core.Node

Copyright © 2018 www.massapicom. 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.