net.i2p.util

## Class I2PAppThread

- java.lang.Object
- - java.lang.Thread
  - - net.i2p.util.I2PThread
    - - net.i2p.util.I2PAppThread

- All Implemented Interfaces:
    Runnable
  Direct Known Subclasses:
    DaemonThread, I2PTunnelOutproxyRunner, I2PTunnelRunner, InternalSocketRunner, UpdateRunner

      public class I2PAppThread
      extends I2PThread

  Like `I2PThread` but with per-thread OOM listeners, rather than a static router-wide listener list, so that an OOM in an app won't call the router listener to shutdown the whole router. This is preferred for application use. See `I2PThread` for features.

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from class net.i2p.util.I2PThread

      `I2PThread.OOMEventListener`

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

      `Thread.State, Thread.UncaughtExceptionHandler`

  - ### Field Summary

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

      `MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `I2PAppThread()`
    `I2PAppThread(Runnable r)`
    `I2PAppThread(Runnable r, String name)`
    `I2PAppThread(Runnable r, String name, boolean isDaemon)`
    `I2PAppThread(String name)`
    `I2PAppThread(ThreadGroup group, Runnable r, String name)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addOOMEventThreadListener(I2PThread.OOMEventListener lsnr)` register a new component that wants notification of OOM events
    `protected void` | `fireOOM(OutOfMemoryError oom)`
    `void` | `removeOOMEventThreadListener(I2PThread.OOMEventListener lsnr)` unregister a component that wants notification of OOM events

    - ### Methods inherited from class net.i2p.util.I2PThread

      `addOOMEventListener, removeOOMEventListener, run, start`

    - ### 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, stop, stop, suspend, toString, yield`

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

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

- - ### Constructor Detail

    - #### I2PAppThread

          public I2PAppThread()

    - #### I2PAppThread

          public I2PAppThread(Runnable r)

    - #### I2PAppThread

          public I2PAppThread(Runnable r,
                              String name)

    - #### I2PAppThread

          public I2PAppThread(Runnable r,
                              String name,
                              boolean isDaemon)

    - #### I2PAppThread

          public I2PAppThread(String name)

    - #### I2PAppThread

          public I2PAppThread(ThreadGroup group,
                              Runnable r,
                              String name)

  - ### Method Detail

    - #### addOOMEventThreadListener

          public void addOOMEventThreadListener(I2PThread.OOMEventListener lsnr)

      register a new component that wants notification of OOM events

    - #### fireOOM

          protected void fireOOM(OutOfMemoryError oom)

      Overrides:
        `fireOOM` in class `I2PThread`

    - #### removeOOMEventThreadListener

          public void removeOOMEventThreadListener(I2PThread.OOMEventListener lsnr)

      unregister a component that wants notification of OOM events