java.lang.Object.finalize()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(5.4k)|赞(0)|评价(0)|浏览(141)

本文整理了Java中java.lang.Object.finalize()方法的一些代码示例,展示了Object.finalize()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Object.finalize()方法的具体详情如下:
包路径:java.lang.Object
类名称:Object
方法名:finalize

Object.finalize介绍

暂无

代码示例

代码示例来源:origin: libgdx/libgdx

@Override
protected void finalize () throws Throwable {
  Log.i(TAG, "service finalized");
  super.finalize();
}

代码示例来源:origin: libgdx/libgdx

@Override
protected void finalize () throws Throwable {
  Log.i(TAG, "service finalized");
  super.finalize();
}

代码示例来源:origin: apache/incubator-dubbo

@Override
protected void finalize() throws Throwable {
  try {
    super.finalize();
  } finally {
    // This object is going to be GCed and it is assumed the ship has sailed to do a proper shutdown. If
    // we have not yet shutdown then we want to make sure we decrement the active instance count.
    if (WORKER_STATE_UPDATER.getAndSet(this, WORKER_STATE_SHUTDOWN) != WORKER_STATE_SHUTDOWN) {
      INSTANCE_COUNTER.decrementAndGet();
    }
  }
}

代码示例来源:origin: apache/incubator-dubbo

@Override
protected void finalize() throws Throwable {
  try {
    super.finalize();
  } finally {
    // This object is going to be GCed and it is assumed the ship has sailed to do a proper shutdown. If
    // we have not yet shutdown then we want to make sure we decrement the active instance count.
    if (WORKER_STATE_UPDATER.getAndSet(this, WORKER_STATE_SHUTDOWN) != WORKER_STATE_SHUTDOWN) {
      INSTANCE_COUNTER.decrementAndGet();
    }
  }
}

代码示例来源:origin: netty/netty

@Override
protected void finalize() throws Throwable {
  try {
    super.finalize();
  } finally {
    free();
  }
}

代码示例来源:origin: netty/netty

@Override
protected void finalize() throws Throwable {
  try {
    super.finalize();
  } finally {
    // This object is going to be GCed and it is assumed the ship has sailed to do a proper shutdown. If
    // we have not yet shutdown then we want to make sure we decrement the active instance count.
    if (WORKER_STATE_UPDATER.getAndSet(this, WORKER_STATE_SHUTDOWN) != WORKER_STATE_SHUTDOWN) {
      INSTANCE_COUNTER.decrementAndGet();
    }
  }
}

代码示例来源:origin: libgdx/libgdx

@Override
  protected void finalize() throws Throwable {
    if (!destroyed && Bullet.enableLogging)
      Gdx.app.error("Bullet", "The "+className+" class does not override the finalize method.");
    super.finalize();
  }
}

代码示例来源:origin: libgdx/libgdx

@Override
protected void finalize() throws Throwable {
  try {
    if (mGLThread != null) {
      // GLThread may still be running if this view was never
      // attached to a window.
      mGLThread.requestExitAndWait();
    }
  } finally {
    super.finalize();
  }
}

代码示例来源:origin: libgdx/libgdx

@Override
  protected void finalize() throws Throwable {
    if (!destroyed && Bullet.enableLogging)
      Gdx.app.error("Bullet", "The "+className+" class does not override the finalize method.");
    super.finalize();
  }
}

代码示例来源:origin: libgdx/libgdx

@Override
protected void finalize() throws Throwable {
  try {
    if (mGLThread != null) {
      // GLThread may still be running if this view was never
      // attached to a window.
      mGLThread.requestExitAndWait();
    }
  } finally {
    super.finalize();
  }
}

代码示例来源:origin: apache/incubator-dubbo

@Override
  protected void finalize() throws Throwable {
    super.finalize();
    if (!ReferenceConfig.this.destroyed) {
      logger.warn("ReferenceConfig(" + url + ") is not DESTROYED when FINALIZE");
      /* don't destroy for now
      try {
        ReferenceConfig.this.destroy();
      } catch (Throwable t) {
          logger.warn("Unexpected err when destroy invoker of ReferenceConfig(" + url + ") in finalize method!", t);
      }
      */
    }
  }
};

代码示例来源:origin: apache/incubator-dubbo

@Override
  protected void finalize() throws Throwable {
    super.finalize();
    if (!ReferenceConfig.this.destroyed) {
      logger.warn("ReferenceConfig(" + url + ") is not DESTROYED when FINALIZE");
      /* don't destroy for now
      try {
        ReferenceConfig.this.destroy();
      } catch (Throwable t) {
          logger.warn("Unexpected err when destroy invoker of ReferenceConfig(" + url + ") in finalize method!", t);
      }
      */
    }
  }
};

代码示例来源:origin: commons-io/commons-io

/**
 * Ensures that the stream is closed before it gets garbage-collected.
 * As mentioned in {@link #close()}, this is a no-op if the stream has
 * already been closed.
 * @throws Throwable if an error occurs
 */
@Override
protected void finalize() throws Throwable {
  close();
  super.finalize();
}

代码示例来源:origin: jenkinsci/jenkins

@Override
protected void finalize() throws Throwable {
  super.finalize();
  dispose();
}

代码示例来源:origin: eclipse-vertx/vert.x

@Override
protected void finalize() throws Throwable {
 // Make sure this gets cleaned up if there are no more references to it
 // so as not to leave connections and resources dangling until the system is shutdown
 // which could make the JVM run out of file handles.
 close();
 super.finalize();
}

代码示例来源:origin: eclipse-vertx/vert.x

@Override
protected void finalize() throws Throwable {
 // Make sure this gets cleaned up if there are no more references to it
 // so as not to leave connections and resources dangling until the system is shutdown
 // which could make the JVM run out of file handles.
 close(ar -> {});
 super.finalize();
}

代码示例来源:origin: eclipse-vertx/vert.x

@Override
protected void finalize() throws Throwable {
 // Make sure this gets cleaned up if there are no more references to it
 // so as not to leave connections and resources dangling until the system is shutdown
 // which could make the JVM run out of file handles.
 close();
 super.finalize();
}

代码示例来源:origin: eclipse-vertx/vert.x

@Override
 protected void finalize() throws Throwable {
  // Make sure this gets cleaned up if there are no more references to it
  // so as not to leave connections and resources dangling until the system is shutdown
  // which could make the JVM run out of file handles.
  close();
  super.finalize();
 }
}

代码示例来源:origin: eclipse-vertx/vert.x

@Override
protected void finalize() throws Throwable {
 close();
 super.finalize();
}

代码示例来源:origin: netty/netty

@Override
protected final void finalize() throws Throwable {
  try {
    super.finalize();
  } finally {
    destroyPoolSubPages(smallSubpagePools);
    destroyPoolSubPages(tinySubpagePools);
    destroyPoolChunkLists(qInit, q000, q025, q050, q075, q100);
  }
}

相关文章