Package edu.vt.rt.hyflow.core

Examples of edu.vt.rt.hyflow.core.AbstractDistinguishable


  public void run() {
    try {
      int localClock = LocalClock.get();
      if(senderClock>localClock)
        LocalClock.advance(senderClock);
      AbstractDistinguishable object = ((TrackerDirectory)DirectoryManager.getManager()).getLocalObject(key);
      int currentLockVersion = object == null ? Integer.MAX_VALUE : LockTable.getLockVersion(object);
      CommunicationManager.getManager().send(from, new ValidateResponse(currentLockVersion, readsetHashcode));
    } catch (IOException e) {
      e.printStackTrace();
    }
View Full Code Here


        Map<Object, AbstractDistinguishable> set = new HashMap<Object, AbstractDistinguishable>();
        for(ReadObjectAccess field: readSet){
          Object obj = field.getObject();
          if(obj!=null){
              if(obj instanceof AbstractDistinguishable){
                AbstractDistinguishable dist = (AbstractDistinguishable) obj;
                set.put(dist.getId(), dist);
              }
            System.out.println("Add " + obj);
          }
          else
            break;
        }
        System.out.println("Readlist " + set.size());
       
          for (AbstractDistinguishable obj: set.values()) {
            if(LockTable.checkLock( obj, clock, false)<0){
              AbstractDistinguishable object = (AbstractDistinguishable)obj;
              try {
                GlobalObject key = ObjectsRegistery.getKey(object.getId());
                if(key==null// deleted object
                  throw new TransactionException();
                Logger.debug("READSET: Remote Validation for " + key);
                try {
              CommunicationManager.getManager().send(key.getHome(), new ValidateRequest(key, hashCode));
View Full Code Here

  public void run() {
    try {
      int localClock = LocalClock.get();
      if(senderClock>localClock)
        LocalClock.advance(senderClock);
      AbstractDistinguishable object = ((DTL2Directory)DirectoryManager.getManager()).getLocalObject(key);
      int currentLockVersion = object == null ? Integer.MAX_VALUE : LockTable.getLockVersion(object);
      CommunicationManager.getManager().send(from, new ValidateResponse(currentLockVersion, readsetHashcode));
    } catch (IOException e) {
      e.printStackTrace();
    }
View Full Code Here

        Map<Object, AbstractDistinguishable> set = new HashMap<Object, AbstractDistinguishable>();
        for(ReadObjectAccess field: readSet){
          Object obj = field.getObject();
          if(obj!=null){
              if(obj instanceof AbstractDistinguishable){
                AbstractDistinguishable dist = (AbstractDistinguishable) obj;
                set.put(dist.getId(), dist);
              }
          }
          else
            break;
        }
        //System.out.println("Readlist " + set.size());
       
          for (AbstractDistinguishable obj: set.values()) {
            if(LockTable.checkLock( obj, clock, false)<0){
              AbstractDistinguishable object = (AbstractDistinguishable)obj;
              try {
                GlobalObject key = ObjectsRegistery.getKey(object.getId());
                if(key==null// deleted object
                  throw new TransactionException();
                Logger.fetal("READSET: Remote Validation for " + key);
                try {
              CommunicationManager.getManager().send(key.getHome(), new ValidateRequest(key, hashCode));
View Full Code Here

  public void run() {
    try {
      int localClock = LocalClock.get();
      if(senderClock>localClock)
        LocalClock.advance(senderClock);
      AbstractDistinguishable object = ((DTL2Directory)DirectoryManager.getManager()).getLocalObject(key);
      int currentLockVersion = object == null ? Integer.MAX_VALUE : LockTable.getLockVersion(object);
      CommunicationManager.getManager().send(from, new ValidateResponse(currentLockVersion, readsetHashcode));
    } catch (IOException e) {
      e.printStackTrace();
    }
View Full Code Here

  @Override
  protected void wakeupWaitingTask(AbstractContext context, GlobalObject key,
      Timespec deadline, Timespec periodTs, int tid) {
    // TODO Auto-generated method stub
    AbstractDistinguishable object = local.get(key);
    if(object != null) {
      // Local
      SignalWaitingTxRequest.signalLocalWaitingTx(object, tid, deadline);
    } else {
      // remote
View Full Code Here

      else
        System.err.println("How? " + Arrays.toString(pendingContexts.values().toArray()));
    }
   
    public void wakeupWaitingTask(AbstractContext context, GlobalObject key, Timespec deadline, Timespec period, int tid) {
      AbstractDistinguishable object = DTL2Directory.getLocal().get(key);
      try {
        //System.out.println("Signal remote threads");
        new SignalWaitingTxRequest(key, tid, object, deadline, period).send(key.getHome());
      } catch (IOException ex) {
        ex.printStackTrace();
View Full Code Here

    }

    Logger.debug("Release Write-Set");
    for(AbstractDistinguishable obj: writeSet){
      if(LockTable.setAndReleaseLock( obj, newClock, locksMarker)){  // is it remote
        AbstractDistinguishable object = (AbstractDistinguishable)obj;
        Object key = obj.getId();
        Logger.debug("I'm new owner of " + key);
        locator.register(object)// register at the directory manager
        Logger.debug("Registered as owner of " + key);
      }
View Full Code Here

      Logger.debug(mode + "| Retrieve request received from " + from + " for " + key + "[" + key.hashCode() + "]");
      key.setHome(PE.thisPE())// adjust the PE error
      int localClock = LocalClock.get();
      if(senderClock>localClock)
        LocalClock.advance(senderClock);
      AbstractDistinguishable object = DTL2Directory.local.get(key);
      if(object==null)
        Logger.debug("Null local object!");
      else if(LockTable.isAvailable(object)){  // check if currently locked
        Logger.debug("Locked object");
        object = null;
      }else{
        GlobalObject globalObject = ObjectsRegistery.getKey(object.getId());
        if(globalObject==null){
          Logger.debug("Deleted object.");
          object = null;
        }else if(globalObject.getVersion()!=key.getVersion()){
          Logger.debug("Old GlobalObject was used to retreive object, retry later.");
          object = null;
        }
      }
      int lockVersion = object==null ? 0 : LockTable.getLockVersion(object);
      Logger.debug("Sending object " + object + "@" + lockVersion + " back");
     
      // check for earleir deadline transactions already in queue
      if(object != null && txMode.equals("w")) {
        String ObjID = object.toString().substring(0, object.toString().indexOf("---"));
       
        boolean addResult = CoarseObjectThreadMap.addThreadEntry(ObjID, deadline, threadID, context.hashCode(), from); // "from" because request received from "from"
        if(addResult == false)
          flagEarlierTx = DTL2Directory.EARLIER_TX_PRESENT;       
      }
View Full Code Here

    }

    Logger.debug("Release Write-Set");
    for(AbstractDistinguishable obj: writeSet){
      if(LockTable.setAndReleaseLock( obj, newClock, locksMarker)){  // is it remote
        AbstractDistinguishable object = (AbstractDistinguishable)obj;
        GlobalObject key = ObjectsRegistery.getKey(object.getId());
        if(key==null){
          System.out.println("TTTTT:"+object.getId());
          continue;
        }
        Logger.debug("I'm new owner of " + key);
        key.setHome(PE.thisPE())// me is the new owner
        ObjectsRegistery.regsiterObject(key)// register key local
View Full Code Here

TOP

Related Classes of edu.vt.rt.hyflow.core.AbstractDistinguishable

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.