org.apache.tinkerpop.gremlin.hadoop.process.computer.util

## Class ComputerSubmissionHelper

- java.lang.Object
- - org.apache.tinkerpop.gremlin.hadoop.process.computer.util.ComputerSubmissionHelper

-     public final class ComputerSubmissionHelper
      extends Object

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `ComputerSubmissionHelper()`

  - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static Future<ComputerResult>` | `runWithBackgroundThread(<any> closure, String threadNameSuffix)` Creates a `Executors.newSingleThreadExecutor(ThreadFactory)` configured make threads that behave like the caller, invokes a closure on it, and shuts it down.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### ComputerSubmissionHelper

          public ComputerSubmissionHelper()

  - ### Method Detail

    - #### runWithBackgroundThread

          public static Future<ComputerResult> runWithBackgroundThread(<any> closure,
                                                                       String threadNameSuffix)

      Creates a `Executors.newSingleThreadExecutor(ThreadFactory)` configured make threads that behave like the caller, invokes a closure on it, and shuts it down.

      This is intended to serve as an alternative to `ForkJoinPool.commonPool()`, which is used by `CompletableFuture.supplyAsync(Supplier)` (among other methods). The single threaded executor created by this method contains a thread with the same context classloader and thread group as the thread that called this method. Threads created in this method also have predictable behavior when `Thread.setContextClassLoader(ClassLoader)` is invoked; threads in the common pool throw a SecurityException if the JVM has a security manager configured.

      The name of the thread created by this method's internal executor is the concatenation of

      - the name of the thread that calls this method
      - "-TP-"
      - the `threadNameSuffix` parameter value
      Parameters:
        `closure` - arbitrary code that has exclusive use of the supplied executor
        `threadNameSuffix` - a string appended to the executor's thread's name
      Returns:
        the return value of the `closure` parameter

Copyright © 2013–2018 Apache Software Foundation. All rights reserved.