# Class CodenameOneThread

java.lang.Object
java.lang.Thread
com.codename1.impl.CodenameOneThread

All Implemented Interfaces:
  `Runnable`

public class CodenameOneThread extends Thread
Thread class implementing the crash protection functionality

- ## Field Summary

  ### Fields inherited from class Thread

  `MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `CodenameOneThread(Runnable r, String threadName)`
  Constructor accepting the runnable

- ## Method Summary

  Modifier and Type
  Method
  Description
  `String`
  `getStack(Throwable t)`
  Prints the stack trace matching the given stack
  `static void`
  `handleException(Throwable err)`
  `boolean`
  `hasStackFrame()`
  `static void`
  `pop()`
  Pops the current method from the stack
  `void`
  `popStack()`
  Pops the method stack pointer
  `static void`
  `push(int method)`
  Pushes the method to the current thread stack
  `void`
  `pushStack(int method)`
  Pushes a method id into the stack
  `void`
  `run()`
  Catches exception
  `static void`
  `storeStack(Throwable th, int currentStackFrame)`
  Stores the stack for the given exception
  `void`
  `storeStackForException(Throwable t, int currentStackFrame)`
  Stores the stack for the given exception

  ### Methods inherited from class Thread

  `activeCount, currentThread, getName, getPriority, getStackTrace, interrupt, isAlive, join, setPriority, sleep, start, toString, yield`

  ### Methods inherited from class Object

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

- ## Constructor Details

  - ### CodenameOneThread

    public CodenameOneThread(Runnable r, String threadName)
    Constructor accepting the runnable

- ## Method Details

  - ### push

    public static void push(int method)

    Pushes the method to the current thread stack

    ###### Parameters

    - `method`: the method id

  - ### pop

    public static void pop()
    Pops the current method from the stack

  - ### storeStack

    public static void storeStack(Throwable th, int currentStackFrame)

    Stores the stack for the given exception

    ###### Parameters

    - `th`: the exception mapping to the given stack

  - ### handleException

    public static void handleException(Throwable err)

  - ### hasStackFrame

    public boolean hasStackFrame()

  - ### pushStack

    public void pushStack(int method)

    Pushes a method id into the stack

    ###### Parameters

    - `method`: the method id

  - ### popStack

    public void popStack()
    Pops the method stack pointer

  - ### storeStackForException

    public void storeStackForException(Throwable t, int currentStackFrame)

    Stores the stack for the given exception

    ###### Parameters

    - `t`: the exception mapping to the given stack

  - ### getStack

    public String getStack(Throwable t)
    Prints the stack trace matching the given stack

  - ### run

    public void run()
    Catches exception
    Specified by:
      `run` in interface `Runnable`
    Overrides:
      `run` in class `Thread`