Package aleph.dir

Examples of aleph.dir.DirectoryManager.open()


      boolean locked = false;
      try {
        account1 = (BankAccount) locator.open(accountNum1);
        locked = true;
        Logger.debug("Lock " + accountNum1);
        account2 = (BankAccount) locator.open(accountNum2);
        Logger.debug("Lock " + accountNum2);
        break;
      } catch (TimeoutException e) {
        Logger.debug("Timeout");
        if(locked){
View Full Code Here


    DirectoryManager locator = HyFlow.getLocator();
    for(int i=0; i<localObjectsCount; i++){
      for(int j=0;j<node;j++){
        if(i%node==j){
          try {
            balance+=((LoanAccount) locator.open(j + "-" + i,"r")).checkBalance();
          } catch (Throwable e) {
            e.printStackTrace();
         
        }
      }
View Full Code Here

  }

  public DistributedImmutableList<E> remove(E value) {
    Stack<DistributedImmutableList<E>> stack = new Stack<DistributedImmutableList<E>>();
    DirectoryManager locator = HyFlow.getLocator();
    for (DistributedImmutableList<E> iter = this; ; iter = (DistributedImmutableList<E>) locator.open(iter.tailID, "r")) {
      if (iter.value.equals(value)) {
        String next = iter.tailID;
        while (!stack.empty()) {
          DistributedImmutableList<E> deletedNode = stack.pop();
          iter = new DistributedImmutableList<E>(deletedNode.value, next);
View Full Code Here

    if (comparison < 0) {  //Go right
      if (this.rightID == null) {     
        return new DistributedImmutableBST<E>(this.data, this.leftID, (String) new DistributedImmutableBST<E>(item).getId());
      }
      DirectoryManager locator = HyFlow.getLocator();
      final DistributedImmutableBST<E> right = (DistributedImmutableBST<E>) locator.open(this.rightID, "r");
      final DistributedImmutableBST<E> newRight = right.add(item);
      if (right.equals(newRight)) {
        return this;
      }
      return new DistributedImmutableBST<E>(this.data, this.leftID, (String) newRight.getId());
View Full Code Here

    else if (comparison > 0) {  //Go left
      if (this.leftID == null) {
        return new DistributedImmutableBST<E>(this.data, (String) new DistributedImmutableBST<E>(item).getId(), this.rightID);
      }
      DirectoryManager locator = HyFlow.getLocator();
      final DistributedImmutableBST<E> left = (DistributedImmutableBST<E>) locator.open(this.leftID, "r");
      final DistributedImmutableBST<E> newLeft = left.add(item);
      if (left.equals(newLeft)) {
        return this;
      }
      return new DistributedImmutableBST<E>(this.data, (String) newLeft.getId(), this.rightID);
View Full Code Here

    if (comparison < 0) {
      if (this.rightID == null) {
        return false;
      }
      DirectoryManager locator = HyFlow.getLocator();
      return ((DistributedImmutableBST<E>) locator.open(this.rightID, "r")).contains(value);
    }
    else if (comparison > 0) {
      if (this.leftID == null) {
        return false;
      }
View Full Code Here

    else if (comparison > 0) {
      if (this.leftID == null) {
        return false;
      }
      DirectoryManager locator = HyFlow.getLocator();
      return ((DistributedImmutableBST<E>) locator.open(this.leftID, "r")).contains(value);
    }
    else {
      return true;
    }
  }
View Full Code Here

    int comparison = this.data.compareTo(value);
    if (comparison < 0) {
      if (this.rightID == null) {
        return this;
      }
      final DistributedImmutableBST<E> right = (DistributedImmutableBST<E>) locator.open(this.rightID, "r");     
      final DistributedImmutableBST<E> newRight = right.remove(value);
      if (right.equals(newRight)) {
        return this;
      }
      return new DistributedImmutableBST<E>(this.data, this.leftID, (newRight == null) ? null : (String) newRight.getId());
View Full Code Here

    }
    else if (comparison > 0) {
      if (this.leftID == null) {
        return this;
      }
      final DistributedImmutableBST<E> left = (DistributedImmutableBST<E>) locator.open(this.leftID, "r");     
      final DistributedImmutableBST<E> newLeft = left.remove(value);
      if (left.equals(newLeft)) {
        return this;
      }
      return new DistributedImmutableBST<E>(this.data, (newLeft == null) ? null : (String) newLeft.getId(), this.rightID);
View Full Code Here

      locator.delete(this);
      if (this.leftID == null && this.rightID == null) {  //0 Children
        return null;
      }
      if (this.leftID == null || this.rightID == null) {  //1 Child
        return (DistributedImmutableBST<E>)((this.leftID != null) ? locator.open(this.leftID, "r") : locator.open(this.rightID, "r"));
      }
      else //2 Children
        //Find Right Child's left most node
        Stack<DistributedImmutableBST<E>> stack = new Stack<DistributedImmutableBST<E>>();
        DistributedImmutableBST<E> iter = (DistributedImmutableBST<E>) locator.open(this.rightID, "r");
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.