Ejemplo n.º 1
0
 protected void cleanUp() {
   search.cleanUp();
   vm.cleanUp();
   reporter.cleanUp();
 }
Ejemplo n.º 2
0
 public <T extends Publisher> void setPublisherTopics(
     Class<T> pCls, int category, String[] topics) {
   if (reporter != null) {
     reporter.setPublisherTopics(pCls, category, topics);
   }
 }
Ejemplo n.º 3
0
  /** runs the verification. */
  public void run() {

    System.out.println("Starting the verification, JPF.java; 610");

    Runtime rt = Runtime.getRuntime();

    // this might be executed consecutively, so notify everybody
    RunRegistry.getDefaultRegistry().reset();

    if (isRunnable()) {
      try {
        if (vm.initialize()) {
          status = Status.RUNNING;
          search.search();
        }
      } catch (OutOfMemoryError oom) {

        // try to get memory back before we do anything that makes it worse
        // (note that we even try to avoid calls here, we are on thin ice)

        // NOTE - we don't try to recover at this point (that is what we do
        // if we fall below search.min_free within search()), we only want to
        // terminate gracefully (incl. report)

        memoryReserve = null; // release something
        long m0 = rt.freeMemory();
        long d = 10000;

        // see if we can reclaim some memory before logging or printing statistics
        for (int i = 0; i < 10; i++) {
          rt.gc();
          long m1 = rt.freeMemory();
          if ((m1 <= m0) || ((m1 - m0) < d)) {
            break;
          }
          m0 = m1;
        }

        logger.severe("JPF out of memory");

        // that's questionable, but we might want to see statistics / coverage
        // to know how far we got. We don't inform any other listeners though
        // if it throws an exception we bail - we can't handle it w/o memory
        try {
          search.notifySearchConstraintHit("JPF out of memory");
          search.error(
              new NoOutOfMemoryErrorProperty()); // JUnit tests will succeed if OOM isn't flagged.
          reporter.searchFinished(search);
        } catch (Throwable t) {
          throw new JPFListenerException("exception during out-of-memory termination", t);
        }

        // NOTE - this is not an exception firewall anymore

      } finally {
        status = Status.DONE;

        config.jpfRunTerminated();
        cleanUp();
      }
    }
  }
Ejemplo n.º 4
0
 public <T extends Publisher> boolean addPublisherExtension(Class<T> pCls, PublisherExtension e) {
   if (reporter != null) {
     return reporter.addPublisherExtension(pCls, e);
   }
   return false;
 }