Example #1
0
 private RMItem readDataFromLog(int id, String key, int xId) {
   synchronized (logArray) {
     int indx;
     if ((indx = logContains(xId)) != -1) {
       Log temp = (Log) logArray.elementAt(indx);
       return (RMItem) temp.get(key);
     }
   }
   return null;
 }
Example #2
0
  public void abort(int transactionId) throws RemoteException, InvalidTransactionException {
    int indx = logContains(transactionId);

    Log temp;

    if (indx > -1) {

      temp = (Log) logArray.elementAt(indx);

    } else {
      System.out.println("nothing in array");
      return;
    }

    for (Enumeration e = temp.getKeys(); e.hasMoreElements(); ) {
      System.out.println("For loop");
      String key = (String) (e.nextElement());
      RMItem obj = temp.get(key);
      if (obj.getType() == 0) {
        Flight flight = (Flight) obj;
        if (flight.getCount() == -1) {
          System.out.println("entering count=-1 block");
          removeData(transactionId, key);
        } else {
          System.out.println("entering other block");
          writeData(transactionId, key, flight);
        }
      } else if (obj.getType() == 1) {
        Customer cust = (Customer) obj;
        if (cust.getID() == -1) {
          System.out.println("entering remove data for customer");
          removeData(transactionId, key);
        } else {
          System.out.println("entering write data for customer");
          writeData(transactionId, key, obj);
        }
      }
    }
  }