static {
    boolean persist;
    try {
      persist = Boolean.getBoolean("HTTPClient.cookies.save");
    } catch (Exception e) {
      persist = false;
    }

    if (persist) {
      loadCookies();

      // the nearest thing to atexit() I know of...

      cookieSaver =
          new Object() {
            public void finalize() {
              saveCookies();
            }
          };
      try {
        System.runFinalizersOnExit(true);
      } catch (Throwable t) {
      }
    }
  }
Esempio n. 2
1
  @SuppressWarnings("deprecation")
  public static void main(String[] args) {
    // TODO 自动生成的方法存根
    System.runFinalizersOnExit(true);

    if (AntonationTest.class.isAnnotationPresent(ThisAntonation.class)) {
      ThisAntonation antonation = AntonationTest.class.getAnnotation(ThisAntonation.class);
      System.out.println(antonation);
      System.out.println(antonation.color());
      System.out.println(antonation.value());
      System.out.println(antonation.arrayAttr().length);
      System.out.println(antonation.lamp().nextLamp());
    }
  }
  /**
   * Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged
   * resources.
   *
   * @param suppressFinalizer Value indicating whether to suppress the garbage collector's
   *     finalizer.
   */
  private void dispose(boolean suppressFinalizer) {
    if (suppressFinalizer) {
      System.runFinalizersOnExit(false);
    }

    synchronized (this) {
      if (!this.isDisposed) {
        if (this.currentHangingRequest != null) {
          this.currentHangingRequest = null;
        }

        this.subscriptions = null;
        this.session = null;

        this.isDisposed = true;
      }
    }
  }
Esempio n. 4
1
 private void fullExit() {
   // http://stackoverflow.com/questions/2092951/how-to-close-android-application
   System.runFinalizersOnExit(true);
   System.exit(0);
 }
Esempio n. 5
0
 @Override
 public void onDestroy() {
   super.onDestroy();
   System.runFinalizersOnExit(true);
   System.exit(0);
 }
 public static void main(String[] args) throws Exception {
   System.runFinalizersOnExit(true);
 }