com.eclipsesource.v8.V8.terminateExecution()方法的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(5.8k)|赞(0)|评价(0)|浏览(184)

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

V8.terminateExecution介绍

[英]Terminates any JavaScript executing on this runtime. Once the runtime is released, any executors that were spawned will also be force terminated.
[中]终止在此运行时上执行的任何JavaScript。一旦释放运行时,生成的任何执行器也将被强制终止。

代码示例

代码示例来源:origin: eclipsesource/J2V8

/**
 * Terminates any JavaScript executing on this runtime. Once
 * the runtime is released, any executors that were spawned
 * will also be force terminated.
 */
public void terminateExecution() {
  forceTerminateExecutors = true;
  terminateExecution(v8RuntimePtr);
}

代码示例来源:origin: eclipsesource/J2V8

/**
 * Forces the executor to shutdown immediately. Any currently executing
 * JavaScript will be interrupted and all outstanding messages will be
 * ignored.
 */
public void forceTermination() {
  synchronized (this) {
    forceTerminating = true;
    shuttingDown = true;
    if (runtime != null) {
      runtime.terminateExecution();
    }
    notify();
  }
}

代码示例来源:origin: eclipsesource/J2V8

/**
 * Terminates any JavaScript executing on this runtime. Once
 * the runtime is released, any executors that were spawned
 * will also be force terminated.
 */
public void terminateExecution() {
  forceTerminateExecutors = true;
  terminateExecution(v8RuntimePtr);
}

代码示例来源:origin: eclipsesource/J2V8

/**
 * Forces the executor to shutdown immediately. Any currently executing
 * JavaScript will be interrupted and all outstanding messages will be
 * ignored.
 */
public void forceTermination() {
  synchronized (this) {
    forceTerminating = true;
    shuttingDown = true;
    if (runtime != null) {
      runtime.terminateExecution();
    }
    notify();
  }
}

代码示例来源:origin: com.eclipsesource.j2v8/j2v8_win32_x86_64

/**
 * Terminates any JavaScript executing on this runtime. Once
 * the runtime is released, any executors that were spawned
 * will also be force terminated.
 */
public void terminateExecution() {
  forceTerminateExecutors = true;
  terminateExecution(v8RuntimePtr);
}

代码示例来源:origin: com.eclipsesource.j2v8/j2v8_macosx_x86_64

/**
 * Terminates any JavaScript executing on this runtime. Once
 * the runtime is released, any executors that were spawned
 * will also be force terminated.
 */
public void terminateExecution() {
  forceTerminateExecutors = true;
  terminateExecution(v8RuntimePtr);
}

代码示例来源:origin: com.eclipsesource.j2v8/j2v8_win32_x86_64

/**
 * Forces the executor to shutdown immediately. Any currently executing
 * JavaScript will be interrupted and all outstanding messages will be
 * ignored.
 */
public void forceTermination() {
  synchronized (this) {
    forceTerminating = true;
    shuttingDown = true;
    if (runtime != null) {
      runtime.terminateExecution();
    }
    notify();
  }
}

代码示例来源:origin: com.eclipsesource.j2v8/j2v8_macosx_x86_64

/**
 * Forces the executor to shutdown immediately. Any currently executing
 * JavaScript will be interrupted and all outstanding messages will be
 * ignored.
 */
public void forceTermination() {
  synchronized (this) {
    forceTerminating = true;
    shuttingDown = true;
    if (runtime != null) {
      runtime.terminateExecution();
    }
    notify();
  }
}

代码示例来源:origin: eclipsesource/J2V8

@Test
public void testNestedExecutorExecution() throws InterruptedException {
  V8 runtime = V8.createV8Runtime();
  runtime.terminateExecution();
  V8Executor executor = new V8Executor("");
  executor.start();
  V8Object key = new V8Object(runtime);
  runtime.registerV8Executor(key, executor);
  key.close();
  runtime.close();
  executor.join();
}

代码示例来源:origin: eclipsesource/J2V8

@Test
public void testGetNestedExecutor() {
  V8 runtime = V8.createV8Runtime();
  runtime.terminateExecution();
  V8Executor executor = new V8Executor("");
  V8Object key = new V8Object(runtime);
  runtime.registerV8Executor(key, executor);
  assertEquals(executor, runtime.getExecutor(key));
  key.close();
  runtime.close();
}

代码示例来源:origin: eclipsesource/J2V8

@Test
public void testTerminateNestedExecutors() {
  V8 runtime = V8.createV8Runtime();
  runtime.terminateExecution();
  V8Executor executor = new V8Executor("while (true){}");
  V8Object key = new V8Object(runtime);
  runtime.registerV8Executor(key, executor);
  runtime.shutdownExecutors(false);
  assertTrue(runtime.getExecutor(key).isShuttingDown());
  key.close();
  runtime.close();
}

代码示例来源:origin: eclipsesource/J2V8

@Test
public void testRemoveNestedExecutor() {
  V8 runtime = V8.createV8Runtime();
  runtime.terminateExecution();
  V8Executor executor = new V8Executor("");
  V8Object key = new V8Object(runtime);
  runtime.registerV8Executor(key, executor);
  V8Executor result = runtime.removeExecutor(key);
  assertEquals(executor, result);
  assertNull(runtime.getExecutor(key));
  key.close();
  runtime.close();
}

代码示例来源:origin: eclipsesource/J2V8

@Test
public void testNestedExecutorExecutionLongRunning() throws InterruptedException {
  V8 runtime = V8.createV8Runtime();
  runtime.terminateExecution();
  V8Executor executor = new V8Executor("foo();") {
    @Override
    protected void setup(final V8 runtime) {
      runtime.registerJavaMethod(new JavaVoidCallback() {
        @Override
        public void invoke(final V8Object receiver, final V8Array parameters) {
          try {
            Thread.sleep(1000);
          } catch (InterruptedException e) {
            e.printStackTrace();
          }
        }
      }, "foo");
    }
  };
  executor.start();
  V8Object key = new V8Object(runtime);
  runtime.registerV8Executor(key, executor);
  key.release();
  runtime.release();
  executor.join();
}

代码示例来源:origin: eclipsesource/J2V8

@Test
public void testGetMissingExecutor() {
  V8 runtime = V8.createV8Runtime();
  runtime.terminateExecution();
  V8Executor executor = new V8Executor("");
  V8Object key = new V8Object(runtime);
  runtime.registerV8Executor(key, executor);
  V8Object anotherKey = new V8Object(runtime);
  V8Executor result = runtime.getExecutor(anotherKey);
  assertNull(result);
  key.close();
  anotherKey.close();
  runtime.close();
}

代码示例来源:origin: eclipsesource/J2V8

@Test
public void testForceTerminateNestedExecutors() throws InterruptedException {
  V8 runtime = V8.createV8Runtime();
  runtime.terminateExecution();
  V8Executor executor = new V8Executor("while (true){}");
  executor.start();
  V8Object key = new V8Object(runtime);
  runtime.registerV8Executor(key, executor);
  runtime.shutdownExecutors(true);
  assertTrue(runtime.getExecutor(key).isShuttingDown());
  executor.join();
  key.close();
  runtime.close();
}

相关文章

V8类方法