@Override public void close() { this.clear(); }
shutdownExecutors(forceTerminateExecutors); if (executors != null) { executors.clear();
@Override public void close() { this.clear(); }
/** * Releases all the resources associated with this map. A * map can be used again once it's released, although * if it's used again it should be released again. */ @Override public void release() { this.clear(); }
/** * Releases all the resources associated with this map. A * map can be used again once it's released, although * if it's used again it should be released again. */ @Override public void release() { this.clear(); }
shutdownExecutors(forceTerminateExecutors); if (executors != null) { executors.clear();
@Test public void testClear() { V8Map<String> map = new V8Map<String>(); V8Object v1 = new V8Object(v8); V8Object v2 = new V8Object(v8); V8Object v3 = new V8Object(v8); map.put(v1, "foo"); map.put(v2, "bar"); map.put(v3, "baz"); map.clear(); assertEquals(0, map.size()); v1.close(); v2.close(); v3.close(); map.close(); }
/** * Release native resources associated with this runtime. Once * released, a runtime cannot be reused. * * @param reportMemoryLeaks True if memory leaks should be * reported by throwing an IllegalStateException if any * objects were not released. */ public void release(final boolean reportMemoryLeaks) { if (isReleased()) { return; } checkThread(); releaseResources(); shutdownExecutors(forceTerminateExecutors); if (executors != null) { executors.clear(); } releaseNativeMethodDescriptors(); synchronized (lock) { runtimeCounter--; } _releaseRuntime(v8RuntimePtr); v8RuntimePtr = 0L; released = true; if (reportMemoryLeaks && (objectReferences > 0)) { throw new IllegalStateException(objectReferences + " Object(s) still exist in runtime"); } }
/** * Release native resources associated with this runtime. Once * released, a runtime cannot be reused. * * @param reportMemoryLeaks True if memory leaks should be * reported by throwing an IllegalStateException if any * objects were not released. */ public void release(final boolean reportMemoryLeaks) { if (isReleased()) { return; } checkThread(); releaseResources(); shutdownExecutors(forceTerminateExecutors); if (executors != null) { executors.clear(); } releaseNativeMethodDescriptors(); synchronized (lock) { runtimeCounter--; } _releaseRuntime(v8RuntimePtr); v8RuntimePtr = 0L; released = true; if (reportMemoryLeaks && (objectReferences > 0)) { throw new IllegalStateException(objectReferences + " Object(s) still exist in runtime"); } }