Examples of MemCheck


Examples of org.apache.derbyTesting.system.nstest.utils.MemCheck

    // check memory in separate thread-- allows us to monitor usage during
    // database calls
    // 200,000 msec = 3min, 20 sec delay between checks
    System.out.println("Starting memory checker thread");
    MemCheck mc = new MemCheck(200000);
    mc.start();

    // Now populate the tables using INIT_THREADS number of threads only if
    // the schemaCreated
    // flag has not been set. If so, then we assume that some other thread
    // from possibly
    // another jvm reached here and has already created the schema and
    // loaded the tables.
    // Note that we kick off threads of this object type (nstest) and use
    // the run method to
    // do the work. The key to starting the init threads is the use of the
    // constructor
    // to indicate to the thread that it is an init thread. In this case, we
    // pass the
    // value INIT to the constructor and in the run method we go to the
    // right section of the
    // code based on what value is passed in. The other possible value that
    // a thread can get
    // is TESTER which indicates that these are the main test threads.

    if (NsTest.schemaCreated == false) {
      // Table was created by this object, so we need to load it
      System.out
      .println("Kicking off initialization threads that will populate the test table");
      NsTest initThreads[] = new NsTest[INIT_THREADS];

      for (int i = 0; i < INIT_THREADS; i++) {
        initThreads[i] = new NsTest(INIT, i);
        initThreads[i].start();
        sleep(3000);
      }

      // Wait for the init threads to finish and join back
      for (int i = 0; i < INIT_THREADS; i++) {
        initThreads[i].join();
      }
    }// end of if(nstest.schemaCreated==false)

    // For informational/debug purposes, print out whether this process
    // created the schema
    if (NsTest.schemaCreated) // true means that the schema was created by
      // another jvm
      System.out
      .println("Schema has already been created by another process!");

    // The following 2 lines are used when you want to only create the test
    // database that can be
    // used as a reference so that subsequent tests do not need to create
    // one of their own.
    // The CREATE_DATABASE_ONLY FLAG is set with the rest of the flags
    if (CREATE_DATABASE_ONLY) {
      System.out
      .println("Finished creating the database, TEST THREADS WILL NOT RUN!!");
      // Finally also stop the memory checker thread, else the test will
      // remain hung!
      mc.stopNow = true;
      mc.join();
      return;
    }

    // Table was created by some other object, so we assume it is already
    // loaded
    // Now kick off the actual test threads that will do the work for us.
    // Note that we use
    // the value TESTER when initializing the threads.
    // The total number of threads is NUMTESTER1+NUMTESTER2+NUMTESTER3
    System.out
    .println("Kicking off test threads that will work over the test table");

    int numTestThread = 0;
    int maxTestThreads = 1 + NUMTESTER1 + NUMTESTER2 + NUMTESTER3;
    NsTest testThreads[] = new NsTest[maxTestThreads];

    // This loop is made of 3 subloops that will initialize the required
    // amount of tester threads
    // It uses the numTestThread variable as the array index which gets
    // incremented in each subloop
    while (numTestThread < maxTestThreads) {
      String runBackup = System.getProperty("derby.nstest.backupRestore");
      // Check for property setting to decide the need for starting
      // BackupRestore thread
      if ((runBackup != null) && (runBackup.equalsIgnoreCase("false"))) {
        System.out.println("BackupRestore Thread not started...");
      } else {
        // Otherwise, start the BackupRestore Thread by default
        testThreads[numTestThread] = new NsTest(BACKUP, numTestThread);
        testThreads[numTestThread].start();
        numTestThread++;
      }

      for (int j = 0; j < NUMTESTER1; j++) {
        testThreads[numTestThread] = new NsTest(TESTER1, numTestThread);
        testThreads[numTestThread].start();
        sleep(3000);
        numTestThread++;
      }
      for (int j = 0; j < NUMTESTER2; j++) {
        testThreads[numTestThread] = new NsTest(TESTER2, numTestThread);
        testThreads[numTestThread].start();
        sleep(3000);
        numTestThread++;
      }
      for (int j = 0; j < NUMTESTER3; j++) {
        testThreads[numTestThread] = new NsTest(TESTER3, numTestThread);
        testThreads[numTestThread].start();
        sleep(3000);
        numTestThread++;
      }

    }

    // Wait for the init threads to finish and join back
    for (int j = 0; j < maxTestThreads; j++) {
      System.out.println("Waiting for thread " + j
          + " to join back/finish");
      testThreads[j].join();
    }

    // Print statistics
    System.out.println("");
    System.out.println("STATISTICS OF OPERATIONS DONE");
    System.out.println("-----------------------------");
    System.out.println("");
    System.out.println("SUCCESSFUL: ");
    System.out.println("  Number of INSERTS = " + numInserts);
    System.out.println("  Number of UPDATES = " + numUpdates);
    System.out.println("  Number of DELETES = " + numDeletes);
    System.out.println("  Number of SELECTS = " + numSelects);
    System.out.println("");
    System.out.println("FAILED: ");
    System.out.println("  Number of failed INSERTS = " + numFailedInserts);
    System.out.println("  Number of failed UPDATES = " + numFailedUpdates);
    System.out.println("  Number of failed DELETES = " + numFailedDeletes);
    System.out.println("  Number of failed SELECTS = " + numFailedSelects);
    System.out.println("");
    System.out.println("  Note that this may not be the same as the server side connections made "
        + "   to the database especially if connection pooling is employed");
    System.out.println("");
    System.out
    .println("NOTE: Failing operations could be because of locking issue that are "
        + "directly related to the application logic.  They are not necessarily bugs.");

    // Finally also stop the memory checker thread
    mc.stopNow = true;
    mc.join();

    System.out
    .println("End of test nstest! Look for 'FAIL' messages in the output and derby.log");

  }// end of main
View Full Code Here

Examples of org.apache.derbyTesting.system.nstest.utils.MemCheck

    // check memory in separate thread-- allows us to monitor usage during
    // database calls
    // 200,000 msec = 3min, 20 sec delay between checks
    logger.println("Starting memory checker thread");
    MemCheck mc = new MemCheck(200000);
    mc.start();

    // Now populate the tables using INIT_THREADS number of threads only if
    // the schemaCreated flag has not been set. If so, then we assume that
    // some other thread from possibly another jvm reached here and has
    // already created the schema and loaded the tables.
    // Note that we kick off threads of this object type (nstest) and use
    // the run method to do the work. The key to starting the init threads
    // is the use of the constructor to indicate to the thread that it is
    // an init thread. In this case, we pass the value INIT to the
    // constructor and in the run method we go to the right section of the
    // code based on what value is passed in. The other possible value that
    // a thread can get is TESTER which indicates that these are the main
    // test threads.

    if (NsTest.schemaCreated == false) {
      // Table was created by this object, so we need to load it
      logger
      .println("Kicking off initialization threads that will populate the test table");
      NsTest initThreads[] = new NsTest[INIT_THREADS];

      for (int i = 0; i < INIT_THREADS; i++) {
        initThreads[i] = new NsTest(INIT, i);
        initThreads[i].start();
        sleep(3000);
      }

      // Wait for the init threads to finish and join back
      for (int i = 0; i < INIT_THREADS; i++) {
        initThreads[i].join();
      }
    }// end of if(nstest.schemaCreated==false)

    // For informational/debug purposes, print out whether this process
    // created the schema
    if (NsTest.schemaCreated) // true means that the schema was created by
      // another jvm
      logger
      .println("Schema has already been created by another process!");

    // The following 2 lines are used when you want to only create the test
    // database that can be used as a reference so that subsequent tests do
    // not need to create one of their own.
    // The CREATE_DATABASE_ONLY FLAG is set with the rest of the flags
    if (CREATE_DATABASE_ONLY) {
      logger
      .println("Finished creating the database, TEST THREADS WILL NOT RUN!!");
      // Finally also stop the memory checker and sequence threads, else the test will
      // remain hung!
      mc.stopNow = true;
      mc.join();
      return;
    }

    // Table was created by some other object, so we assume it is already
    // loaded
    // Now kick off the actual test threads that will do the work for us.
    // Note that we use the value TESTER when initializing the threads.
    // The total number of threads is NUMTESTER1+NUMTESTER2+NUMTESTER3
    logger
    .println("Kicking off test threads that will work over the test table");

    int numTestThread = 0;
    int maxTestThreads = 0;
    String runBackup = System.getProperty( BACKUP_FLAG );
    if ((runBackup != null) && (runBackup.equalsIgnoreCase("false")))
        maxTestThreads = NUMTESTER1 + NUMTESTER2 + NUMTESTER3;
    else
        maxTestThreads = 1 + NUMTESTER1 + NUMTESTER2 + NUMTESTER3;
    testThreads = new NsTest[maxTestThreads];

    // This loop is made of 3 subloops that will initialize the required
    // amount of tester threads
    // It uses the numTestThread variable as the array index which gets
    // incremented in each subloop
    while (numTestThread < maxTestThreads) {
      // Check for property setting to decide the need for starting
      // BackupRestore thread
      if ((runBackup != null) && (runBackup.equalsIgnoreCase("false"))) {
        logger.println("BackupRestore Thread not started...");
      } else {
        // Otherwise, start the BackupRestore Thread by default
        testThreads[numTestThread] = new NsTest(BACKUP, numTestThread);
        testThreads[numTestThread].start();
        numTestThread++;
      }

      for (int j = 0; j < NUMTESTER1; j++) {
        testThreads[numTestThread] = new NsTest(TESTER1, numTestThread);
        testThreads[numTestThread].start();
        sleep(3000);
        numTestThread++;
      }
      for (int j = 0; j < NUMTESTER2; j++) {
        testThreads[numTestThread] = new NsTest(TESTER2, numTestThread);
        testThreads[numTestThread].start();
        sleep(3000);
        numTestThread++;
      }
      for (int j = 0; j < NUMTESTER3; j++) {
        testThreads[numTestThread] = new NsTest(TESTER3, numTestThread);
        testThreads[numTestThread].start();
        sleep(3000);
        numTestThread++;
      }

    }

    // check sequence value thread
    // 60,000 msec = 1 minute delay between checks
    logger.println("Starting sequence reader thread");
    SequenceReader  sequenceReader = new SequenceReader( DriverManager.getConnection( jdbcUrl, prop ), 60000 );
    sequenceReader.start();

    // Wait for the test threads to finish and join back
    for (int j = 0; j < maxTestThreads; j++)
        {
            logger.println("Waiting for thread " + j+ " to join back/finish");
      testThreads[j].join();
    }

        if ( timerThread != null )
        {
            timerThread.stopNow();
            timerThread.interrupt();
            timerThread.join();
        }

        // stop the sequence reader thread
    sequenceReader.stopNow = true;
    sequenceReader.interrupt();
    sequenceReader.join();

    // Print statistics
        printStatistics();

    // Finally also stop the memory checker thread
    mc.stopNow = true;
    mc.join();

    logger
    .println("End of test nstest! Look for 'FAIL' messages in the output and derby.log");

  }// end of main
View Full Code Here

Examples of org.apache.derbyTesting.system.nstest.utils.MemCheck

    // check memory in separate thread-- allows us to monitor usage during
    // database calls
    // 200,000 msec = 3min, 20 sec delay between checks
    System.out.println("Starting memory checker thread");
    MemCheck mc = new MemCheck(200000);
    mc.start();

    // Now populate the tables using INIT_THREADS number of threads only if
    // the schemaCreated
    // flag has not been set. If so, then we assume that some other thread
    // from possibly
    // another jvm reached here and has already created the schema and
    // loaded the tables.
    // Note that we kick off threads of this object type (nstest) and use
    // the run method to
    // do the work. The key to starting the init threads is the use of the
    // constructor
    // to indicate to the thread that it is an init thread. In this case, we
    // pass the
    // value INIT to the constructor and in the run method we go to the
    // right section of the
    // code based on what value is passed in. The other possible value that
    // a thread can get
    // is TESTER which indicates that these are the main test threads.

    if (NsTest.schemaCreated == false) {
      // Table was created by this object, so we need to load it
      System.out
      .println("Kicking off initialization threads that will populate the test table");
      NsTest initThreads[] = new NsTest[INIT_THREADS];

      for (int i = 0; i < INIT_THREADS; i++) {
        initThreads[i] = new NsTest(INIT, i);
        initThreads[i].start();
        sleep(3000);
      }

      // Wait for the init threads to finish and join back
      for (int i = 0; i < INIT_THREADS; i++) {
        initThreads[i].join();
      }
    }// end of if(nstest.schemaCreated==false)

    // For informational/debug purposes, print out whether this process
    // created the schema
    if (NsTest.schemaCreated) // true means that the schema was created by
      // another jvm
      System.out
      .println("Schema has already been created by another process!");

    // The following 2 lines are used when you want to only create the test
    // database that can be
    // used as a reference so that subsequent tests do not need to create
    // one of their own.
    // The CREATE_DATABASE_ONLY FLAG is set with the rest of the flags
    if (CREATE_DATABASE_ONLY) {
      System.out
      .println("Finished creating the database, TEST THREADS WILL NOT RUN!!");
      // Finally also stop the memory checker thread, else the test will
      // remain hung!
      mc.stopNow = true;
      mc.join();
      return;
    }

    // Table was created by some other object, so we assume it is already
    // loaded
    // Now kick off the actual test threads that will do the work for us.
    // Note that we use
    // the value TESTER when initializing the threads.
    // The total number of threads is NUMTESTER1+NUMTESTER2+NUMTESTER3
    System.out
    .println("Kicking off test threads that will work over the test table");

    int numTestThread = 0;
    int maxTestThreads = 1 + NUMTESTER1 + NUMTESTER2 + NUMTESTER3;
    NsTest testThreads[] = new NsTest[maxTestThreads];

    // This loop is made of 3 subloops that will initialize the required
    // amount of tester threads
    // It uses the numTestThread variable as the array index which gets
    // incremented in each subloop
    while (numTestThread < maxTestThreads) {
      String runBackup = System.getProperty("derby.nstest.backupRestore");
      // Check for property setting to decide the need for starting
      // BackupRestore thread
      if ((runBackup != null) && (runBackup.equalsIgnoreCase("false"))) {
        System.out.println("BackupRestore Thread not started...");
      } else {
        // Otherwise, start the BackupRestore Thread by default
        testThreads[numTestThread] = new NsTest(BACKUP, numTestThread);
        testThreads[numTestThread].start();
        numTestThread++;
      }

      for (int j = 0; j < NUMTESTER1; j++) {
        testThreads[numTestThread] = new NsTest(TESTER1, numTestThread);
        testThreads[numTestThread].start();
        sleep(3000);
        numTestThread++;
      }
      for (int j = 0; j < NUMTESTER2; j++) {
        testThreads[numTestThread] = new NsTest(TESTER2, numTestThread);
        testThreads[numTestThread].start();
        sleep(3000);
        numTestThread++;
      }
      for (int j = 0; j < NUMTESTER3; j++) {
        testThreads[numTestThread] = new NsTest(TESTER3, numTestThread);
        testThreads[numTestThread].start();
        sleep(3000);
        numTestThread++;
      }

    }

    // Wait for the init threads to finish and join back
    for (int j = 0; j < maxTestThreads; j++) {
      System.out.println("Waiting for thread " + j
          + " to join back/finish");
      testThreads[j].join();
    }

    // Print statistics
    System.out.println("");
    System.out.println("STATISTICS OF OPERATIONS DONE");
    System.out.println("-----------------------------");
    System.out.println("");
    System.out.println("SUCCESSFUL: ");
    System.out.println("  Number of INSERTS = " + numInserts);
    System.out.println("  Number of UPDATES = " + numUpdates);
    System.out.println("  Number of DELETES = " + numDeletes);
    System.out.println("  Number of SELECTS = " + numSelects);
    System.out.println("");
    System.out.println("FAILED: ");
    System.out.println("  Number of failed INSERTS = " + numFailedInserts);
    System.out.println("  Number of failed UPDATES = " + numFailedUpdates);
    System.out.println("  Number of failed DELETES = " + numFailedDeletes);
    System.out.println("  Number of failed SELECTS = " + numFailedSelects);
    System.out.println("");
    System.out.println("  Note that this may not be the same as the server side connections made "
        + "   to the database especially if connection pooling is employed");
    System.out.println("");
    System.out
    .println("NOTE: Failing operations could be because of locking issue that are "
        + "directly related to the application logic.  They are not necessarily bugs.");

    // Finally also stop the memory checker thread
    mc.stopNow = true;
    mc.join();

    System.out
    .println("End of test nstest! Look for 'FAIL' messages in the output and derby.log");

  }// end of main
View Full Code Here

Examples of org.apache.derbyTesting.system.nstest.utils.MemCheck

    // check memory in separate thread-- allows us to monitor usage during
    // database calls
    // 200,000 msec = 3min, 20 sec delay between checks
    System.out.println("Starting memory checker thread");
    MemCheck mc = new MemCheck(200000);
    mc.start();

    // Now populate the tables using INIT_THREADS number of threads only if
    // the schemaCreated
    // flag has not been set. If so, then we assume that some other thread
    // from possibly
    // another jvm reached here and has already created the schema and
    // loaded the tables.
    // Note that we kick off threads of this object type (nstest) and use
    // the run method to
    // do the work. The key to starting the init threads is the use of the
    // constructor
    // to indicate to the thread that it is an init thread. In this case, we
    // pass the
    // value INIT to the constructor and in the run method we go to the
    // right section of the
    // code based on what value is passed in. The other possible value that
    // a thread can get
    // is TESTER which indicates that these are the main test threads.

    if (NsTest.schemaCreated == false) {
      // Table was created by this object, so we need to load it
      System.out
      .println("Kicking off initialization threads that will populate the test table");
      NsTest initThreads[] = new NsTest[INIT_THREADS];

      for (int i = 0; i < INIT_THREADS; i++) {
        initThreads[i] = new NsTest(INIT, i);
        initThreads[i].start();
        sleep(3000);
      }

      // Wait for the init threads to finish and join back
      for (int i = 0; i < INIT_THREADS; i++) {
        initThreads[i].join();
      }
    }// end of if(nstest.schemaCreated==false)

    // For informational/debug purposes, print out whether this process
    // created the schema
    if (NsTest.schemaCreated) // true means that the schema was created by
      // another jvm
      System.out
      .println("Schema has already been created by another process!");

    // The following 2 lines are used when you want to only create the test
    // database that can be
    // used as a reference so that subsequent tests do not need to create
    // one of their own.
    // The CREATE_DATABASE_ONLY FLAG is set with the rest of the flags
    if (CREATE_DATABASE_ONLY) {
      System.out
      .println("Finished creating the database, TEST THREADS WILL NOT RUN!!");
      // Finally also stop the memory checker thread, else the test will
      // remain hung!
      mc.stopNow = true;
      mc.join();
      return;
    }

    // Table was created by some other object, so we assume it is already
    // loaded
    // Now kick off the actual test threads that will do the work for us.
    // Note that we use
    // the value TESTER when initializing the threads.
    // The total number of threads is NUMTESTER1+NUMTESTER2+NUMTESTER3
    System.out
    .println("Kicking off test threads that will work over the test table");

    int numTestThread = 0;
    int maxTestThreads = 1 + NUMTESTER1 + NUMTESTER2 + NUMTESTER3;
    NsTest testThreads[] = new NsTest[maxTestThreads];

    // This loop is made of 3 subloops that will initialize the required
    // amount of tester threads
    // It uses the numTestThread variable as the array index which gets
    // incremented in each subloop
    while (numTestThread < maxTestThreads) {
      String runBackup = System.getProperty("derby.nstest.backupRestore");
      // Check for property setting to decide the need for starting
      // BackupRestore thread
      if ((runBackup != null) && (runBackup.equalsIgnoreCase("false"))) {
        System.out.println("BackupRestore Thread not started...");
      } else {
        // Otherwise, start the BackupRestore Thread by default
        testThreads[numTestThread] = new NsTest(BACKUP, numTestThread);
        testThreads[numTestThread].start();
        numTestThread++;
      }

      for (int j = 0; j < NUMTESTER1; j++) {
        testThreads[numTestThread] = new NsTest(TESTER1, numTestThread);
        testThreads[numTestThread].start();
        sleep(3000);
        numTestThread++;
      }
      for (int j = 0; j < NUMTESTER2; j++) {
        testThreads[numTestThread] = new NsTest(TESTER2, numTestThread);
        testThreads[numTestThread].start();
        sleep(3000);
        numTestThread++;
      }
      for (int j = 0; j < NUMTESTER3; j++) {
        testThreads[numTestThread] = new NsTest(TESTER3, numTestThread);
        testThreads[numTestThread].start();
        sleep(3000);
        numTestThread++;
      }

    }

    // Wait for the init threads to finish and join back
    for (int j = 0; j < maxTestThreads; j++) {
      System.out.println("Waiting for thread " + j
          + " to join back/finish");
      testThreads[j].join();
    }

    // Print statistics
    System.out.println("");
    System.out.println("STATISTICS OF OPERATIONS DONE");
    System.out.println("-----------------------------");
    System.out.println("");
    System.out.println("SUCCESSFUL: ");
    System.out.println("  Number of INSERTS = " + numInserts);
    System.out.println("  Number of UPDATES = " + numUpdates);
    System.out.println("  Number of DELETES = " + numDeletes);
    System.out.println("  Number of SELECTS = " + numSelects);
    System.out.println("");
    System.out.println("FAILED: ");
    System.out.println("  Number of failed INSERTS = " + numFailedInserts);
    System.out.println("  Number of failed UPDATES = " + numFailedUpdates);
    System.out.println("  Number of failed DELETES = " + numFailedDeletes);
    System.out.println("  Number of failed SELECTS = " + numFailedSelects);
    System.out.println("");
    System.out.println("  Note that this may not be the same as the server side connections made "
        + "   to the database especially if connection pooling is employed");
    System.out.println("");
    System.out
    .println("NOTE: Failing operations could be because of locking issue that are "
        + "directly related to the application logic.  They are not necessarily bugs.");

    // Finally also stop the memory checker thread
    mc.stopNow = true;
    mc.join();

    System.out
    .println("End of test nstest! Look for 'FAIL' messages in the output and derby.log");

  }// end of main
View Full Code Here

Examples of org.apache.derbyTesting.system.nstest.utils.MemCheck

    // check memory in separate thread-- allows us to monitor usage during
    // database calls
    // 200,000 msec = 3min, 20 sec delay between checks
    System.out.println("Starting memory checker thread");
    MemCheck mc = new MemCheck(200000);
    mc.start();

    // Now populate the tables using INIT_THREADS number of threads only if
    // the schemaCreated flag has not been set. If so, then we assume that
    // some other thread from possibly another jvm reached here and has
    // already created the schema and loaded the tables.
    // Note that we kick off threads of this object type (nstest) and use
    // the run method to do the work. The key to starting the init threads
    // is the use of the constructor to indicate to the thread that it is
    // an init thread. In this case, we pass the value INIT to the
    // constructor and in the run method we go to the right section of the
    // code based on what value is passed in. The other possible value that
    // a thread can get is TESTER which indicates that these are the main
    // test threads.

    if (NsTest.schemaCreated == false) {
      // Table was created by this object, so we need to load it
      System.out
      .println("Kicking off initialization threads that will populate the test table");
      NsTest initThreads[] = new NsTest[INIT_THREADS];

      for (int i = 0; i < INIT_THREADS; i++) {
        initThreads[i] = new NsTest(INIT, i);
        initThreads[i].start();
        sleep(3000);
      }

      // Wait for the init threads to finish and join back
      for (int i = 0; i < INIT_THREADS; i++) {
        initThreads[i].join();
      }
    }// end of if(nstest.schemaCreated==false)

    // For informational/debug purposes, print out whether this process
    // created the schema
    if (NsTest.schemaCreated) // true means that the schema was created by
      // another jvm
      System.out
      .println("Schema has already been created by another process!");

    // The following 2 lines are used when you want to only create the test
    // database that can be used as a reference so that subsequent tests do
    // not need to create one of their own.
    // The CREATE_DATABASE_ONLY FLAG is set with the rest of the flags
    if (CREATE_DATABASE_ONLY) {
      System.out
      .println("Finished creating the database, TEST THREADS WILL NOT RUN!!");
      // Finally also stop the memory checker thread, else the test will
      // remain hung!
      mc.stopNow = true;
      mc.join();
      return;
    }

    // Table was created by some other object, so we assume it is already
    // loaded
    // Now kick off the actual test threads that will do the work for us.
    // Note that we use the value TESTER when initializing the threads.
    // The total number of threads is NUMTESTER1+NUMTESTER2+NUMTESTER3
    System.out
    .println("Kicking off test threads that will work over the test table");

    int numTestThread = 0;
    int maxTestThreads = 0;
    String runBackup = System.getProperty("derby.nstest.backupRestore");
    if ((runBackup != null) && (runBackup.equalsIgnoreCase("false")))
        maxTestThreads = NUMTESTER1 + NUMTESTER2 + NUMTESTER3;
    else
        maxTestThreads = 1 + NUMTESTER1 + NUMTESTER2 + NUMTESTER3;
    testThreads = new NsTest[maxTestThreads];

    // This loop is made of 3 subloops that will initialize the required
    // amount of tester threads
    // It uses the numTestThread variable as the array index which gets
    // incremented in each subloop
    while (numTestThread < maxTestThreads) {
      // Check for property setting to decide the need for starting
      // BackupRestore thread
      if ((runBackup != null) && (runBackup.equalsIgnoreCase("false"))) {
        System.out.println("BackupRestore Thread not started...");
      } else {
        // Otherwise, start the BackupRestore Thread by default
        testThreads[numTestThread] = new NsTest(BACKUP, numTestThread);
        testThreads[numTestThread].start();
        numTestThread++;
      }

      for (int j = 0; j < NUMTESTER1; j++) {
        testThreads[numTestThread] = new NsTest(TESTER1, numTestThread);
        testThreads[numTestThread].start();
        sleep(3000);
        numTestThread++;
      }
      for (int j = 0; j < NUMTESTER2; j++) {
        testThreads[numTestThread] = new NsTest(TESTER2, numTestThread);
        testThreads[numTestThread].start();
        sleep(3000);
        numTestThread++;
      }
      for (int j = 0; j < NUMTESTER3; j++) {
        testThreads[numTestThread] = new NsTest(TESTER3, numTestThread);
        testThreads[numTestThread].start();
        sleep(3000);
        numTestThread++;
      }

    }

    // Wait for the test threads to finish and join back
    for (int j = 0; j < maxTestThreads; j++) {
      System.out.println("Waiting for thread " + j
          + " to join back/finish");
      testThreads[j].join();
    }

    // Print statistics
    System.out.println("");
    System.out.println("STATISTICS OF OPERATIONS DONE");
    System.out.println("-----------------------------");
    System.out.println("");
    System.out.println("SUCCESSFUL: ");
    System.out.println("  Number of INSERTS = " + numInserts);
    System.out.println("  Number of UPDATES = " + numUpdates);
    System.out.println("  Number of DELETES = " + numDeletes);
    System.out.println("  Number of SELECTS = " + numSelects);
    System.out.println("");
    System.out.println("FAILED: ");
    System.out.println("  Number of failed INSERTS = " + numFailedInserts);
    System.out.println("  Number of failed UPDATES = " + numFailedUpdates);
    System.out.println("  Number of failed DELETES = " + numFailedDeletes);
    System.out.println("  Number of failed SELECTS = " + numFailedSelects);
    System.out.println("");
    System.out.println("  Note that this may not be the same as the server side connections made\n"
        + "   to the database especially if connection pooling is employed");
    System.out.println("");
    System.out
    .println("NOTE: Failing operations could be because of locking issue that are\n"
        + "directly related to the application logic.  They are not necessarily bugs.");

    // Finally also stop the memory checker thread
    mc.stopNow = true;
    mc.join();

    System.out
    .println("End of test nstest! Look for 'FAIL' messages in the output and derby.log");

  }// end of main
View Full Code Here

Examples of org.apache.derbyTesting.system.sttest.tools.MemCheck

    Date d = new Date();
    status.firstMessage(connections_to_make, d);
    // check memory in separate thread-- allows us to monitor
    // usage during database calls
    // 200,000 msec = 3min, 20 sec delay between checks
    MemCheck mc = new MemCheck(200000);
    mc.start();
    Sttest testsessions[] = new Sttest[connections_to_make];
    for (int i = 0; i < connections_to_make; i++) {
      testsessions[i] = new Sttest(i);
      testsessions[i].start();
      sleep(3000);
    }
    for (int i = 0; i < connections_to_make; i++) {
      testsessions[i].join();
    }
    try {
      mc.stopNow = true;
      mc.join();
    } catch (Throwable t) {
      throw (t);
    }
  }
View Full Code Here

Examples of org.apache.derbyTesting.system.sttest.tools.MemCheck

    try {
      conn = mystartJBMS();
    } catch (Throwable t) {
      return;
    }
    MemCheck mc = new MemCheck(200000);
    mc.start();
    compress(conn);
    System.exit(0);
  }
View Full Code Here

Examples of org.apache.derbyTesting.system.sttest.tools.MemCheck

    Date d = new Date();
    status.firstMessage(connections_to_make, d);
    // check memory in separate thread-- allows us to monitor
    // usage during database calls
    // 200,000 msec = 3min, 20 sec delay between checks
    MemCheck mc = new MemCheck(200000);
    mc.start();
    Sttest testsessions[] = new Sttest[connections_to_make];
    for (int i = 0; i < connections_to_make; i++) {
      testsessions[i] = new Sttest(i);
      testsessions[i].start();
      sleep(3000);
    }
    for (int i = 0; i < connections_to_make; i++) {
      testsessions[i].join();
    }
    try {
      mc.stopNow = true;
      mc.join();
    } catch (Throwable t) {
      throw (t);
    }
  }
View Full Code Here

Examples of org.apache.derbyTesting.system.sttest.tools.MemCheck

    Date d = new Date();
    status.firstMessage(connections_to_make, d);
    // check memory in separate thread-- allows us to monitor
    // usage during database calls
    // 200,000 msec = 3min, 20 sec delay between checks
    MemCheck mc = new MemCheck(200000);
    mc.start();
    Sttest testsessions[] = new Sttest[connections_to_make];
    for (int i = 0; i < connections_to_make; i++) {
      testsessions[i] = new Sttest(i);
      testsessions[i].start();
      sleep(3000);
    }
    for (int i = 0; i < connections_to_make; i++) {
      testsessions[i].join();
    }
    try {
      mc.stopNow = true;
      mc.join();
    } catch (Throwable t) {
      throw (t);
    }
  }
View Full Code Here

Examples of org.apache.derbyTesting.system.sttest.tools.MemCheck

    try {
      conn = mystartJBMS();
    } catch (Throwable t) {
      return;
    }
    MemCheck mc = new MemCheck(200000);
    mc.start();
    compress(conn);
    System.exit(0);
  }
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.