Package aleph.dir

Examples of aleph.dir.DirectoryManager.open()


  }
 
  public static void transfer(String accountNum1, String accountNum2, int amount){
    DirectoryManager locator = HyFlow.getLocator();
    _BankAccount account1 = (_BankAccount) locator.open(accountNum1);
    _BankAccount account2 = (_BankAccount) locator.open(accountNum2);
   
    for(int i=0; i<Benchmark.calls; i++)
      account1.withdraw(amount);
   
    try {
View Full Code Here


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

  }
 
  @Atomic
  public static long totalBalance(String accountNum1, String accountNum2){
    DirectoryManager locator = HyFlow.getLocator();
    BankAccount account1 = (BankAccount) locator.open(accountNum1);
    BankAccount account2 = (BankAccount) locator.open(accountNum2);
   
    long balance = 0;
    for(int i=0; i<Benchmark.calls; i++)
      balance += account1.checkBalance();
View Full Code Here

 
  @Atomic
  public static long totalBalance(String accountNum1, String accountNum2){
    DirectoryManager locator = HyFlow.getLocator();
    BankAccount account1 = (BankAccount) locator.open(accountNum1);
    BankAccount account2 = (BankAccount) locator.open(accountNum2);
   
    long balance = 0;
    for(int i=0; i<Benchmark.calls; i++)
      balance += account1.checkBalance();
   
View Full Code Here

  }

  @Atomic
  public void add(Integer value){
    DirectoryManager locator = HyFlow.getLocator();
    Node head = (Node)locator.open(HEAD);
    String oldNext = head.getNext();
    String newNodeId =  Network.getInstance().getID() + "-" + Math.random()// generate random id
    Node newNode = new Node(newNodeId, value);
    newNode.setNext(oldNext);
    head.setNext(newNodeId);
View Full Code Here

    return balance;
  }
 
  public static void transfer(String accountNum1, String accountNum2, int amount){
    DirectoryManager locator = HyFlow.getLocator();
    BankAccount account1 = (BankAccount) locator.open(accountNum1);
    BankAccount account2 = (BankAccount) locator.open(accountNum2);
   
    for(int i=0; i<Benchmark.calls; i++)
      account1.withdraw(amount);
   
View Full Code Here

  public boolean delete(Integer value){
    DirectoryManager locator = HyFlow.getLocator();
    String next = HEAD;
    String prev = null;
    do// find the last node
      Node node = (Node)locator.open(next, "r");
      if(value.equals(node.getValue())){
        Node deletedNode = (Node)locator.open(next)//reopen for write to be deleted
        Node prevNode = (Node)locator.open(prev);    //open previous node for write
        prevNode.setNext(deletedNode.getNext());
        locator.delete(deletedNode);
View Full Code Here

  }
 
  public static void transfer(String accountNum1, String accountNum2, int amount){
    DirectoryManager locator = HyFlow.getLocator();
    BankAccount account1 = (BankAccount) locator.open(accountNum1);
    BankAccount account2 = (BankAccount) locator.open(accountNum2);
   
    for(int i=0; i<Benchmark.calls; i++)
      account1.withdraw(amount);
   
    try {
View Full Code Here

    String next = HEAD;
    String prev = null;
    do// find the last node
      Node node = (Node)locator.open(next, "r");
      if(value.equals(node.getValue())){
        Node deletedNode = (Node)locator.open(next)//reopen for write to be deleted
        Node prevNode = (Node)locator.open(prev);    //open previous node for write
        prevNode.setNext(deletedNode.getNext());
        locator.delete(deletedNode);
        System.out.println("<" + node.getId() + "> " + node.getValue() + "  DELETED....");
        return true;
View Full Code Here

    for(int i=0; i<localObjectsCount; i++){
      for(int j=0;j<node;j++){
        if(i%node==j){
          try {
            System.err.println("Balance = " + balance);
            balance+=((BankAccount) locator.open(j + "-" + i,"r")).checkBalance();
          } catch (Throwable e) {
            e.printStackTrace();
         
        }
      }
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.