コード例 #1
0
  private void lookupParentCoordinator() {
    if (((AbstractOverlayNode<?, ?>) skyNetNode.getOverlayNode())
        .getPeerStatus()
        .equals(PeerStatus.PRESENT)) {
      log.debug(
          SkyNetUtilities.getTimeAndNetID(skyNetNode)
              + "starts a lookup for the key "
              + coordinatorKey.getPlainSkyNetID());
      treeHandlerDelegator.lookupParentCoordinator(
          coordinatorKey,
          new OperationCallback<OverlayContact<OverlayID<?>>>() {

            @Override
            public void calledOperationFailed(Operation<OverlayContact<OverlayID<?>>> op) {
              lookupOperationFailed(op);
            }

            @Override
            public void calledOperationSucceeded(Operation<OverlayContact<OverlayID<?>>> op) {
              lookupOperationSucceeded(op);
            }
          });
    } else {
      log.warn("SkyNetNode cannot lookup ParentCoordinator" + ", because he is not PRESENT");
    }
  }
コード例 #2
0
  public TreeHandler(SkyNetNodeInterface node, TreeHandlerDelegator treeHandlerDelegator) {
    branchingFactor =
        SkyNetPropertiesReader.getInstance().getIntProperty("SkyNetTreeBranchingFactor");

    this.skyNetNode = node;
    this.treeHandlerDelegator = treeHandlerDelegator;
    this.treeHandlerDelegator.setSkyNetNode(skyNetNode);
    this.treeHandlerDelegator.setOwnOverlayNode(skyNetNode.getOverlayNode());
    isRoot = false;
    parentCoordinator = new SkyNetNodeInfoImpl(null, null, null, -1);
    coordinatorKey = null;
    level = 0;
  }
コード例 #3
0
  /**
   * If it is possible to calculate the responsibility interval of a peer on the current overlay,
   * this method calculates the corresponding responsibility interval of the node in the ID-space of
   * SkyNet. In this context, the responsibility interval is used to test, if a SkyNet-node is
   * responsible for a Coordinator.
   *
   * @param id contains the ID of this SkyNet-node
   */
  public void calculateResponsibilityInterval(SkyNetID id) {
    if (((AbstractOverlayNode<?, ?>) skyNetNode.getOverlayNode())
        .getPeerStatus()
        .equals(PeerStatus.PRESENT)) {
      // execute getPredecessor-method
      final SkyNetID ownID = id;
      treeHandlerDelegator.calculateResponsibilityInterval(
          ownID,
          new OperationCallback<OverlayContact<OverlayID<?>>>() {

            @Override
            public void calledOperationFailed(Operation<OverlayContact<OverlayID<?>>> op) {
              calculateResponsibilityIntervalOperationFailed(op);
            }

            @Override
            public void calledOperationSucceeded(Operation<OverlayContact<OverlayID<?>>> op) {
              calculateResponsibilityIntervalOperationSucceeded(op, ownID);
            }
          });
    } else {
      log.warn("SkyNetNode cannot get Predecessor" + ", because he is not PRESENT");
    }
  }