Package com.sun.faban.driver

Examples of com.sun.faban.driver.FatalException


                     // now, on best effort.

        // Run the calibration loop and collect data.
        for (int i = 0, tooLong = 0; i < iterations;) {
            if (tooLong > limit) // prevent infinite loops.
                throw new FatalException("Cannot establish clock offset " +
                                         "(ms->ns), retries " + i + "," +
                                         tooLong);

            long nanos;
            long millis;
            long millisBefore = System.currentTimeMillis();
            do {
               nanos = System.nanoTime();
               millis = System.currentTimeMillis();
            } while (millis == millisBefore);

            // Now we're on the edge of a new ms value
            // Find the ms clock step for this system
            // by iterating down the min step value.
            clockStep[i] = (int) (millis - millisBefore);
            if (clockStep[i] < msStep)
                msStep = clockStep[i];

            // If we discover any step bigger than the best recorded step,
            // ignore the iteration.
            if (msStep != Integer.MAX_VALUE && clockStep[i] > msStep) {
                ++tooLong;
                continue;
            }

            diffms[i] = millis - nanos / Utilities.TO_NANOS;
            diffns[i] = (int) (nanos % Utilities.TO_NANOS);
            logger.finer("iter: " + i + ", millis: " + millis +
                    ", nanos: " + nanos + ", diffms: " + diffms[i] +
                    ", diffns: " + diffns[i] + ", stepms: " + clockStep[i]);
            tooLong = 0; // Reset retry counters on success.
            ++i;
        }
        logger.fine("System.currentTimeMillis() granularity is " + msStep +
                    "ms");

        // There might still be some records left at the beginning before
        // that have the step > minstep. This happens before the minstep
        // is established. We must not use these records. Count them and
        // report. If more than 25% are bad, don't continue.
        int badRecords = 0;
        for (int i = 0; i < clockStep.length; i++) {
            if (clockStep[i] > msStep) {
                logger.finer("Rejected bad record " + i +
                             "Edge mis-detection. Clock step of " +
                             clockStep[i] + "ms higher than granularity.");
                ++badRecords;
            }
        }
        if (badRecords > iterations / 4) {
            throw new FatalException("Cannot establish clock offset " +
                    "(ms->ns), edge mis-detections beyond threshold - " +
                    badRecords + " out of " + iterations +
                    ". Perhaps system is too busy.");
        } else {
            logger.fine("Rejected " + badRecords + " bad records.");
View Full Code Here


     * @return The thread's cookie handler
     */
    public static ThreadCookieHandler getInstance() {
        ThreadCookieHandler instance = localRef.get();
        if (instance == null) {
      throw new FatalException(
                    "Cookie handler not initialized for thread.");
    }
        return instance;
    }
View Full Code Here

     * @param e The throwable
     * @param m The method
     */
    void checkFatal(Throwable e, Method m) {
        if (e instanceof FatalException) {
            FatalException fatal = (FatalException) e;
            e = fatal.getCause();
            if (e != null) {
        logger.log(Level.SEVERE, name + '.' + m.getName() +
                        ": " + e.getMessage(), e);
      } else {
        logger.log(Level.SEVERE, name + '.' + m.getName() +
                        ": " + fatal.getMessage(), fatal);
      }
            fatal.setLogged();
            agent.abortRun();
            throw fatal; // Also don't continue with current thread.
        }
    }
View Full Code Here

                agent.abortRun();
            } else {
                timer.wakeupAt(agent.startTime);
            }
        } catch (InterruptedException e) { // Run is killed.
            throw new FatalException(e);
        }
    }
View Full Code Here

                        "before critical section in operation.";

            }
            logger.severe(msg);
            agent.abortRun();
            throw new FatalException(msg);
        } else if (timingInfo.respondTime == TIME_NOT_SET &&
                   timingInfo.lastRespondTime == TIME_NOT_SET) {
            String msg = null;
            if (driverConfig.operations[
                    currentOperation].timing == Timing.AUTO) {
                msg = name + '.' + op.m.getName() +
                        ": Transport incomplete! " +
                        "Please ensure transport exception is " +
                        "thrown from operation.";
            } else {
                msg = name + '.' + op.m.getName() +
                        ": Cannot determine end time! " +
                        "DriverContext.recordTime() not called " +
                        "after critical section in operation.";

            }
            logger.severe(msg);
            agent.abortRun();
            throw new FatalException(msg);
        } else if (timingInfo.respondTime == TIME_NOT_SET) {
            timingInfo.respondTime = timingInfo.lastRespondTime;
            logger.fine("Potential open request in operation " +
                    op.m.getName() + ".");
        }
View Full Code Here

            try {
                Thread.sleep(10000); // But wait for some cleanup before we do
            } catch (InterruptedException e) {
              logger.log(Level.FINE, e.getMessage(), e);
            }
            throw new FatalException("Run Aborted.");
        }

        logger.info("Started all threads; run commences in " + sleepTime +
                " ms");
        try {
View Full Code Here

        if (respondTime == TIME_NOT_SET) {
            if (driverContext.timingInfo.lastRespondTime != TIME_NOT_SET) {
                logger.fine("Potential pending open request.");
                respondTime = driverContext.timingInfo.lastRespondTime;
            } else {
          throw new FatalException("isTxSteadyState called before " +
                      "response time capture. Cannot determine tx in steady" +
                      " state or not. This is a bug in the driver code.");
            }
    }
View Full Code Here

TOP

Related Classes of com.sun.faban.driver.FatalException

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.