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
    Modifier and Type
    Field
    Description
    static final int
    The maximum priority that a thread can have.
    static final int
    The minimum priority that a thread can have.
    static final int
    The default priority that is assigned to a thread.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Constructor accepting the runnable
  • Method Summary

    Modifier and Type
    Method
    Description
    Prints the stack trace matching the given stack
    static void
     
    boolean
     
    static void
    pop()
    Pops the current method from the stack
    void
    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
    Modifier and Type
    Method
    Description
    static int
    Returns the current number of active threads in the virtual machine.
    static Thread
    Returns a reference to the currently executing Thread object.
    final String
    Returns this thread's name.
    final int
    Returns this thread's priority.
     
    void
    Interrupts this thread.
    final boolean
    Tests if this thread is alive.
    final void
    Waits for this thread to die.
    final void
    setPriority(int newPriority)
    Changes the priority of this thread.
    static void
    sleep(long millis)
    Causes the currently executing thread to sleep (temporarily cease execution) for the specified number of milliseconds.
    void
    Causes this thread to begin execution; the Java Virtual Machine calls the run method of this thread.
    Returns a string representation of this thread, including the thread's name and priority.
    static void
    Causes the currently executing thread object to temporarily pause and allow other threads to execute.

    Methods inherited from class Object

    clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
    Modifier and Type
    Method
    Description
    protected Object
     
    boolean
    Indicates whether some other object is "equal to" this one.
    final Class
    Returns the runtime class of an object.
    int
    Returns a hash code value for the object.
    final void
    Wakes up a single thread that is waiting on this object's monitor.
    final void
    Wakes up all threads that are waiting on this object's monitor.
    final void
    Causes current thread to wait until another thread invokes the method or the method for this object.
    final void
    wait(long timeout)
    Causes current thread to wait until either another thread invokes the method or the method for this object, or a specified amount of time has elapsed.
    final void
    wait(long timeout, int nanos)
    Causes current thread to wait until another thread invokes the method or the method for this object, or some other thread interrupts the current thread, or a certain amount of real time has elapsed.
  • 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