Package org.deuce.transaction.lsacm.field

Examples of org.deuce.transaction.lsacm.field.WriteFieldAccess


  private boolean onReadAccess(Object obj, long field, Type type) {
    if (vr) {
      // Visible read
      if (readLock == LockTable.LOCKED_WRITE) {
        // We already own that lock in write mode
        WriteFieldAccess w = writeSet.get(readHash, obj, field);
        if (w == null)
          return false;
        readValue = w.getValue();
        return true;
      } else {
        // We already own that lock in read mode
        return false;
      }
    } else {
      // Invisible read
      if ((status.get() & STATUS_MASK) != TX_ACTIVE) {
        // We have been killed: abort
        throw KILLED_EXCEPTION;
      }
      if (readLock == LockTable.LOCKED_WRITE) {
        // We already own that lock in write mode
        WriteFieldAccess w = writeSet.get(readHash, obj, field);
        if (w == null)
          return false;
        readValue = w.getValue();
        return true;
      } else if (readLock == LockTable.LOCKED_READ) {
        // We already own that lock in read mode
        return false;
      }
View Full Code Here


    return entries.isEmpty();
  }

  public WriteFieldAccess get(int hash, Object obj, long field) {
    // Return value from existing entry
    WriteFieldAccess w = entries.get(hash);
    while (w != null) {
      // Check if we have already written that field
      if (w.getReference() == obj && w.getField() == field)
        return w;
      w = w.getNext();
    }
    return null;
  }
View Full Code Here

    return null;
  }

  public void appendWrite(int hash, Object obj, long field, Object value, Type type) {
    // Append to existing entry (write mode)
    WriteFieldAccess w = entries.get(hash);
    while (w != null) {
      // Check if we have already written that field
      if (w.getReference() == obj && w.getField() == field) {
        // Update written value
        w.update(type, value);
        return;
      }
      WriteFieldAccess next = w.getNext();
      if (next == null) {
        // We did not write this field (we must add it to write set)
        w.setNext(new WriteFieldAccess(obj, field, type, value, hash, 0));
        return;
      }
      w = next;
    }
  }
View Full Code Here

    }
  }

  public void addWrite(int hash, Object obj, long field, Object value, Type type, long timestamp) {
    // Add new entry (write mode)
    entries.put(hash, new WriteFieldAccess(obj, field, type, value, hash, timestamp));
  }
View Full Code Here

    entries.put(hash, new WriteFieldAccess(obj, field, type, value, hash, timestamp));
  }

  public void addRead(int hash, Object obj, long field, long timestamp) {
    // Add new entry (read mode)
    entries.put(hash, new WriteFieldAccess(obj, field, hash, timestamp));
  }
View Full Code Here

TOP

Related Classes of org.deuce.transaction.lsacm.field.WriteFieldAccess

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.