com.jacob.com

## Class STA

- java.lang.Object
- - java.lang.Thread
  - - com.jacob.com.STA

- All Implemented Interfaces:
    java.lang.Runnable
  Direct Known Subclasses:
    MainSTA

      public class STA
      extends java.lang.Thread

  A class that implements a Single Threaded Apartment. Users will subclass this and override OnInit() and OnQuit() where they will create and destroy a COM component that wants to run in an STA other than the main STA.

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from class java.lang.Thread

      `java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `int` | `threadID` referenced by STA.cpp

    - ### Fields inherited from class java.lang.Thread

      `MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `STA()` constructor for STA

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `doMessagePump()` run a message pump for the main STA
    `boolean` | `OnInit()` Override this method to create and initialize any COM component that you want to run in this thread.
    `void` | `OnQuit()` Override this method to destroy any resource before the thread exits and COM in uninitialized
    `void` | `quit()` calls quitMessagePump
    `void` | `quitMessagePump()` quit message pump for the main STA
    `void` | `run()`

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

      `activeCount, checkAccess, clone, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield`

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

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

- - ### Field Detail

    - #### threadID

          public int threadID

      referenced by STA.cpp

  - ### Constructor Detail

    - #### STA

          public STA()

      constructor for STA

  - ### Method Detail

    - #### run

          public void run()

      Specified by:
        `run` in interface `java.lang.Runnable`
      Overrides:
        `run` in class `java.lang.Thread`

    - #### OnInit

          public boolean OnInit()

      Override this method to create and initialize any COM component that you want to run in this thread. If anything fails, return false to terminate the thread.
      Returns:
        always returns true

    - #### OnQuit

          public void OnQuit()

      Override this method to destroy any resource before the thread exits and COM in uninitialized

    - #### quit

          public void quit()

      calls quitMessagePump

    - #### doMessagePump

          public void doMessagePump()

      run a message pump for the main STA

    - #### quitMessagePump

          public void quitMessagePump()

      quit message pump for the main STA

http://jacob-project.sourceforge.net