示例#1
0
  public void clearscheduleAndQueueTPCC(int index, String key, long l, String clId, long tInv) {
    Scheduler scheduler = new Scheduler();
    // Session session = null;
    String cLevel = "ALL", condn = "price>20";
    ClientQueryExampleThread clientQueryExampleThread = new ClientQueryExampleThread(clId, tInv, 1);
    if (ClientQueryExampleThread.session == null || ClientQueryExampleThread.session.isClosed())
      ClientQueryExampleThread.session =
          ClientQueryExampleThread.callClient(cLevel, condn); // unblock for deploy
    Query q = null;
    // UUID idOne = UUID.randomUUID();
    String CLID = null; // String.valueOf(idOne) + String.valueOf(System.currentTimeMillis());
    long latencyDep = 0;
    CopyOnWriteArrayList<RegistryEntry> rList = null;
    String STATUS;
    l = System.currentTimeMillis() - l;
    // key = (String)
    // ((HashMap<String,String>)DependencyChecker.serializeList.get(index)).keySet().toArray()[0];

    curr_deadline = curr_deadline - (System.currentTimeMillis() - tInv);

    System.out.println("***After executing the query index" + index);
    releaseLock(ClientQueryExampleThread.session, key, clId, index); // unblock for deploy
    removeregistry(ClientQueryExampleThread.session, key, clId, index); // unblock for deploy
    System.out.println("***After release lock and registry cleanup for the query index" + index);
  }
示例#2
0
  public void scheduleAndQueueTPCC(int index, String key, long l, String clId, long tInv) {
    Scheduler scheduler = new Scheduler();
    // Session session = null;
    String cLevel = "ALL", condn = "price>20";
    ClientQueryExampleThread clientQueryExampleThread = new ClientQueryExampleThread(clId, tInv, 1);
    if (ClientQueryExampleThread.session == null || ClientQueryExampleThread.session.isClosed())
      ClientQueryExampleThread.session =
          ClientQueryExampleThread.callClient(cLevel, condn); // unblock for deploy
    Query q = null;
    // UUID idOne = UUID.randomUUID();
    String CLID = null; // String.valueOf(idOne) + String.valueOf(System.currentTimeMillis());
    long latencyDep = 0;
    l = System.currentTimeMillis() - l;
    // key = (String)
    // ((HashMap<String,String>)DependencyChecker.serializeList.get(index)).keySet().toArray()[0];

    curr_deadline = curr_deadline - (System.currentTimeMillis() - tInv);
    createRegistry(ClientQueryExampleThread.session);

    writeToRegister(
        key,
        index,
        clId,
        l,
        latencyDep,
        curr_deadline,
        "OFF",
        ClientQueryExampleThread.session); // unblock for deploy
    System.out.println(
        "***After write to register"); // for thread "+Thread.currentThread().getName());
    // CLID = readFromRegister(key, session);//unblock for deploy
    // System.out.println("****rlist size:="+ rList.size());
    // if(rList.size()>0)
    // if(CLID!=null)
    // {
    // CLID = scheduler.schedule(rList).split(":")[0];
    // STATUS = scheduler.schedule(rList).split(":")[1];

    while (readFromRegister(key, ClientQueryExampleThread.session) != null
        && readFromRegister(key, ClientQueryExampleThread.session).contains(":")
        && readFromRegister(key, ClientQueryExampleThread.session)
            .split(":")[1]
            .equalsIgnoreCase("OFF")
        && !clId.equalsIgnoreCase(
            readFromRegister(key, ClientQueryExampleThread.session)
                .split(":")[0])) // || !STATUS.equalsIgnoreCase("OFF"))
    {
      // System.out.println("***Client " + clId +"Waiting for the lock to the column "+key);// for
      // thread "+Thread.currentThread().getName());
      // System.out.println("***Waiting for the lock to the column "+key);// for thread
      // "+Thread.currentThread().getName());
    }
    scheduler.requestLock(ClientQueryExampleThread.session, key, clId, index); // unblock for deploy
    System.out.println("***After requesting the lock to the columnfor the query index" + index);
  }
示例#3
0
  public synchronized Tuple callInterface(
      String condn, String className, String CLID, long tInv, int currthreadCount) {
    Scheduler scheduler = new Scheduler();
    ClientQueryExampleThread clientQueryExampleThread =
        new ClientQueryExampleThread(CLID, tInv, currthreadCount);
    // TODO Auto-generated method stub
    // Session session = null;
    // String cLevel= "ALL",condn = "QTY>20";
    String cLevel = "ONE";
    // Tuple tuple = new Tuple();

    if (!scheduler.checkschedulability()) {
      System.out.println(
          "Not Schedulable under given SLA."); // for thread "+Thread.currentThread().getName());
      System.exit(1);
    }

    if (ClientQueryExampleThread.tuple == null
        || ClientQueryExampleThread.tuple.getSession() == null
        || ClientQueryExampleThread.tuple.getSession().isClosed()) {
      if (DependencyChecker.queryList == null || DependencyChecker.queryList.size() <= 0) {
        DependencyChecker.getGuarantee(condn, className, CLID, tInv);
        // System.out.println("***dependencyChecker
        // tSerializeLis:="+dependencyChecker.getSerializeList().size());
        // tuple.seDependencyChecker();
      }
      ClientQueryExampleThread.tuple = new Tuple();
      Session session = ClientQueryExampleThread.callClient(cLevel, condn);
      ClientQueryExampleThread.tuple.setSession(session); // unblock for deploy
      // System.out.println("***After ClientQueryExampleThread.tuple
      // session:="+ClientQueryExampleThread.tuple.getSession());
      ArrayBlockingQueue<Query> causalQueue = Interface.pushQueues();
      System.out.println(
          "***DependencyChecker.serializeList.size():=" + DependencyChecker.serializeList.size());
      /*while(DependencyChecker.serializeList.size()<=1){

      }*/
      if (DependencyChecker.serializeList.size() > 1) Verifier.chooseConsistencyLevels();
      ClientQueryExampleThread.tuple.setCausalQueue(causalQueue);
    }
    // tuple.setSession(ClientQueryExampleThread.session);
    return ClientQueryExampleThread.tuple;
  }