Package com.sun.jna.platform.win32.COM.util

## Class ComThread

- java.lang.Object
- - com.sun.jna.platform.win32.COM.util.ComThread

-     public class ComThread
      extends java.lang.Object

- - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `(package private) java.util.concurrent.ExecutorService` | `executor` |
    `(package private) java.lang.Runnable` | `firstTask` |
    `(package private) boolean` | `requiresInitialisation` |
    `(package private) long` | `timeoutMilliseconds` |
    `(package private) java.lang.Thread.UncaughtExceptionHandler` | `uncaughtExceptionHandler` |

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `ComThread​(java.lang.String threadName, long timeoutMilliseconds, java.lang.Thread.UncaughtExceptionHandler uncaughtExceptionHandler)` |
    `ComThread​(java.lang.String threadName, long timeoutMilliseconds, java.lang.Thread.UncaughtExceptionHandler uncaughtExceptionHandler, int coinitialiseExFlag)` |

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `<T> T` | `execute​(java.util.concurrent.Callable<T> task)` |
    `protected void` | `finalize()` |
    `(package private) static void` | `setComThread​(boolean value)` |
    `void` | `terminate​(long timeoutMilliseconds)` | Stop the COM Thread.

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

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

- - ### Field Detail

    - #### executor

          java.util.concurrent.ExecutorService executor

    - #### firstTask

          java.lang.Runnable firstTask

    - #### requiresInitialisation

          boolean requiresInitialisation

    - #### timeoutMilliseconds

          long timeoutMilliseconds

    - #### uncaughtExceptionHandler

          java.lang.Thread.UncaughtExceptionHandler uncaughtExceptionHandler

  - ### Constructor Detail

    - #### ComThread

          public ComThread​(java.lang.String threadName,
                           long timeoutMilliseconds,
                           java.lang.Thread.UncaughtExceptionHandler uncaughtExceptionHandler)

    - #### ComThread

          public ComThread​(java.lang.String threadName,
                           long timeoutMilliseconds,
                           java.lang.Thread.UncaughtExceptionHandler uncaughtExceptionHandler,
                           int coinitialiseExFlag)

  - ### Method Detail

    - #### terminate

          public void terminate​(long timeoutMilliseconds)

      Stop the COM Thread.
      Parameters:
        `timeoutMilliseconds` - number of milliseconds to wait for a clean shutdown before a forced shutdown is attempted

    - #### finalize

          protected void finalize()
                           throws java.lang.Throwable

      Overrides:
        `finalize` in class `java.lang.Object`
      Throws:
        `java.lang.Throwable`

    - #### setComThread

          static void setComThread​(boolean value)

    - #### execute

          public <T> T execute​(java.util.concurrent.Callable<T> task)
                        throws java.util.concurrent.TimeoutException,
                               java.lang.InterruptedException,
                               java.util.concurrent.ExecutionException

      Throws:
        `java.util.concurrent.TimeoutException`
        `java.lang.InterruptedException`
        `java.util.concurrent.ExecutionException`