/**@class java.lang.Thread implements java.lang.Runnable @extends java.lang.Object A {@code Thread} is a concurrent unit of execution. It has its own call stack for methods being invoked, their arguments and local variables. Each application has at least one thread running when it is started, the main thread, in the main {@link java.lang.ThreadGroup}. The runtime keeps its own threads in the system thread group. <p>There are two ways to execute code in a new thread. You can either subclass {@code Thread} and overriding its {@link #run}() method, or construct a new {@code Thread} and pass a {@link java.lang.Runnable} to the constructor. In either case, the {@link #start}() method must be called to actually execute the new {@code Thread}. <p>Each {@code Thread} has an integer priority that affect how the thread is scheduled by the OS. A new thread inherits the priority of its parent. A thread's priority can be set using the {@link #setPriority}(int) method. */ var Thread = { /** The maximum priority value allowed for a thread. This corresponds to (but does not have the same value as) {@code android.os.Process.THREAD_PRIORITY_URGENT_DISPLAY}. */ MAX_PRIORITY : "10", /** The minimum priority value allowed for a thread. This corresponds to (but does not have the same value as) {@code android.os.Process.THREAD_PRIORITY_LOWEST}. */ MIN_PRIORITY : "1", /** The normal (default) priority value assigned to the main thread. This corresponds to (but does not have the same value as) {@code android.os.Process.THREAD_PRIORITY_DEFAULT}. */ NORM_PRIORITY : "5", /**Returns the number of active {@code Thread}s in the running {@code Thread}'s group and its subgroups. @return {Number} the number of {@code Thread}s */ activeCount : function( ) {}, /**Does nothing. */ checkAccess : function( ) {}, /**Returns the number of stack frames in this thread. @return {Number} Number of stack frames @deprecated The results of this call were never well defined. To make things worse, it would depend on whether the Thread was suspended or not, and suspend was deprecated too. */ countStackFrames : function( ) {}, /**Returns the Thread of the caller, that is, the current Thread. */ currentThread : function( ) {}, /**Throws {@code UnsupportedOperationException}. @deprecated Not implemented. */ destroy : function( ) {}, /**Prints to the standard error stream a text representation of the current stack for this Thread. @see Throwable#printStackTrace() */ dumpStack : function( ) {}, /**Copies an array with all Threads which are in the same ThreadGroup as the receiver - and subgroups - into the array <code>threads</code> passed as parameter. If the array passed as parameter is too small no exception is thrown - the extra elements are simply not copied. @param {Object {java.lang.Thread[]}} threads array into which the Threads will be copied @return {Number} How many Threads were copied over */ enumerate : function( ) {}, /**Returns a map of all the currently live threads to their stack traces. */ getAllStackTraces : function( ) {}, /**Returns the context ClassLoader for this Thread. @return {Object {java.lang.ClassLoader}} ClassLoader The context ClassLoader @see java.lang.ClassLoader @see #getContextClassLoader() */ getContextClassLoader : function( ) {}, /**Returns the default exception handler that's executed when uncaught exception terminates a thread. @return {Object {java.lang.Thread.UncaughtExceptionHandler}} an {@link UncaughtExceptionHandler} or <code>null</code> if none exists. */ getDefaultUncaughtExceptionHandler : function( ) {}, /**Returns the thread's identifier. The ID is a positive <code>long</code> generated on thread creation, is unique to the thread, and doesn't change during the lifetime of the thread; the ID may be reused after the thread has been terminated. @return {Number} the thread's ID. */ getId : function( ) {}, /**Returns the name of the Thread. */ getName : function( ) {}, /**Returns the priority of the Thread. */ getPriority : function( ) {}, /**Returns an array of {@link java.lang.StackTraceElement} representing the current thread's stack. */ getStackTrace : function( ) {}, /**Returns the current state of the Thread. This method is useful for monitoring purposes. @return {Object {java.lang.Thread.State}} a {@link State} value. */ getState : function( ) {}, /**Returns the ThreadGroup to which this Thread belongs. @return {Object {java.lang.ThreadGroup}} the Thread's ThreadGroup */ getThreadGroup : function( ) {}, /**Returns the thread's uncaught exception handler. If not explicitly set, then the ThreadGroup's handler is returned. If the thread is terminated, then <code>null</code> is returned. @return {Object {java.lang.Thread.UncaughtExceptionHandler}} an {@link UncaughtExceptionHandler} instance or {@code null}. */ getUncaughtExceptionHandler : function( ) {}, /**Posts an interrupt request to this {@code Thread}. The behavior depends on the state of this {@code Thread}: <ul> <li> {@code Thread}s blocked in one of {@code Object}'s {@code wait()} methods or one of {@code Thread}'s {@code join()} or {@code sleep()} methods will be woken up, their interrupt status will be cleared, and they receive an {@link java.lang.InterruptedException}. <li> {@code Thread}s blocked in an I/O operation of an {@link java.nio.channels.InterruptibleChannel} will have their interrupt status set and receive an {@link java.nio.channels.ClosedByInterruptException}. Also, the channel will be closed. <li> {@code Thread}s blocked in a {@link java.nio.channels.Selector} will have their interrupt status set and return immediately. They don't receive an exception in this case. <ul> @see Thread#interrupted @see Thread#isInterrupted */ interrupt : function( ) {}, /**Returns a <code>boolean</code> indicating whether the current Thread ( <code>currentThread()</code>) has a pending interrupt request (<code> true</code>) or not (<code>false</code>). It also has the side-effect of clearing the flag. @return {Boolean} a <code>boolean</code> indicating the interrupt status @see Thread#currentThread @see Thread#interrupt @see Thread#isInterrupted */ interrupted : function( ) {}, /**Returns <code>true</code> if the receiver has already been started and still runs code (hasn't died yet). Returns <code>false</code> either if the receiver hasn't been started yet or if it has already started and run to completion and died. @return {Boolean} a <code>boolean</code> indicating the liveness of the Thread @see Thread#start */ isAlive : function( ) {}, /**Tests whether this is a daemon thread. A daemon thread only runs as long as there are non-daemon threads running. When the last non-daemon thread ends, the runtime will exit. This is not normally relevant to applications with a UI. */ isDaemon : function( ) {}, /**Returns a <code>boolean</code> indicating whether the receiver has a pending interrupt request (<code>true</code>) or not ( <code>false</code>) @return {Boolean} a <code>boolean</code> indicating the interrupt status @see Thread#interrupt @see Thread#interrupted */ isInterrupted : function( ) {}, /**Blocks the current Thread (<code>Thread.currentThread()</code>) until the receiver finishes its execution and dies. @throws InterruptedException if the current thread has been interrupted. The interrupted status of the current thread will be cleared before the exception is thrown. @see Object#notifyAll @see java.lang.ThreadDeath */ join : function( ) {}, /**Blocks the current Thread (<code>Thread.currentThread()</code>) until the receiver finishes its execution and dies or the specified timeout expires, whatever happens first. <p>A timeout of zero means the calling thread should wait forever unless interrupted. @param {Number} millis The maximum time to wait (in milliseconds). @throws InterruptedException if the current thread has been interrupted. The interrupted status of the current thread will be cleared before the exception is thrown. @see Object#notifyAll @see java.lang.ThreadDeath */ join : function( ) {}, /**Blocks the current Thread (<code>Thread.currentThread()</code>) until the receiver finishes its execution and dies or the specified timeout expires, whatever happens first. <p>A timeout of zero means the calling thread should wait forever unless interrupted. @param {Number} millis The maximum time to wait (in milliseconds). @param {Number} nanos Extra nanosecond precision @throws InterruptedException if the current thread has been interrupted. The interrupted status of the current thread will be cleared before the exception is thrown. @see Object#notifyAll @see java.lang.ThreadDeath */ join : function( ) {}, /**Throws {@code UnsupportedOperationException}. @deprecated Only useful in conjunction with deprecated method {@link Thread#suspend}. */ resume : function( ) {}, /**Calls the <code>run()</code> method of the Runnable object the receiver holds. If no Runnable is set, does nothing. @see Thread#start */ run : function( ) {}, /**Set the context ClassLoader for the receiver. @param {Object {ClassLoader}} cl The context ClassLoader @see #getContextClassLoader() */ setContextClassLoader : function( ) {}, /**Marks this thread as a daemon thread. A daemon thread only runs as long as there are non-daemon threads running. When the last non-daemon thread ends, the runtime will exit. This is not normally relevant to applications with a UI. @throws IllegalThreadStateException - if this thread has already started. */ setDaemon : function( ) {}, /**Sets the default uncaught exception handler. This handler is invoked in case any Thread dies due to an unhandled exception. @param {Object {Thread.UncaughtExceptionHandler}} handler The handler to set or null. */ setDefaultUncaughtExceptionHandler : function( ) {}, /**Adds a runnable to be invoked upon interruption. If this thread has already been interrupted, the runnable will be invoked immediately. The action should be idempotent as it may be invoked multiple times for a single interruption. <p>Each call to this method must be matched with a corresponding call to {@link #popInterruptAction$}. @hide used by NIO */ pushInterruptAction$ : function( ) {}, /**Removes {@code interruptAction} so it is not invoked upon interruption. @param {Object {Runnable}} interruptAction the pushed action, used to check that the call stack is correctly nested. @hide used by NIO */ popInterruptAction$ : function( ) {}, /**Sets the name of the Thread. @param {String} threadName the new name for the Thread @see Thread#getName */ setName : function( ) {}, /**Sets the priority of this thread. If the requested priority is greater than the parent thread group's {@link java.lang.ThreadGroup#getMaxPriority}, the group's maximum priority will be used instead. @throws IllegalArgumentException - if the new priority is greater than {@link #MAX_PRIORITY} or less than {@link #MIN_PRIORITY} */ setPriority : function( ) {}, /**<p> Sets the uncaught exception handler. This handler is invoked in case this Thread dies due to an unhandled exception. </p> @param {Object {Thread.UncaughtExceptionHandler}} handler The handler to set or <code>null</code>. */ setUncaughtExceptionHandler : function( ) {}, /**Causes the thread which sent this message to sleep for the given interval of time (given in milliseconds). The precision is not guaranteed - the Thread may sleep more or less than requested. @param {Number} time The time to sleep in milliseconds. @throws InterruptedException if the current thread has been interrupted. The interrupted status of the current thread will be cleared before the exception is thrown. @see Thread#interrupt() */ sleep : function( ) {}, /**Causes the thread which sent this message to sleep for the given interval of time (given in milliseconds and nanoseconds). The precision is not guaranteed - the Thread may sleep more or less than requested. @param {Number} millis The time to sleep in milliseconds. @param {Number} nanos Extra nanosecond precision @throws InterruptedException if the current thread has been interrupted. The interrupted status of the current thread will be cleared before the exception is thrown. @see Thread#interrupt() */ sleep : function( ) {}, /**Starts the new Thread of execution. The <code>run()</code> method of the receiver will be called by the receiver Thread itself (and not the Thread calling <code>start()</code>). @throws IllegalThreadStateException - if this thread has already started. @see Thread#run */ start : function( ) {}, /**Requests the receiver Thread to stop and throw ThreadDeath. The Thread is resumed if it was suspended and awakened if it was sleeping, so that it can proceed to throw ThreadDeath. @deprecated because stopping a thread in this manner is unsafe and can leave your application and the VM in an unpredictable state. */ stop : function( ) {}, /**Throws {@code UnsupportedOperationException}. @deprecated because stopping a thread in this manner is unsafe and can leave your application and the VM in an unpredictable state. */ stop : function( ) {}, /**Throws {@code UnsupportedOperationException}. @deprecated May cause deadlocks. */ suspend : function( ) {}, /**Returns a string containing a concise, human-readable description of the Thread. It includes the Thread's name, priority, and group name. @return {String} a printable representation for the receiver. */ toString : function( ) {}, /**Causes the calling Thread to yield execution time to another Thread that is ready to run. The actual scheduling is implementation-dependent. */ yield : function( ) {}, /**Indicates whether the current Thread has a monitor lock on the specified object. @param {Object {Object}} object the object to test for the monitor lock @return {Boolean} true if the current thread has a monitor lock on the specified object; false otherwise */ holdsLock : function( ) {}, /**Unparks this thread. This unblocks the thread it if it was previously parked, or indicates that the thread is "preemptively unparked" if it wasn't already parked. The latter means that the next time the thread is told to park, it will merely clear its latent park bit and carry on without blocking. <p>See {@link java.util.concurrent.locks.LockSupport} for more in-depth information of the behavior of this method.</p> @hide for Unsafe */ unpark$ : function( ) {}, /**Parks the current thread for a particular number of nanoseconds, or indefinitely. If not indefinitely, this method unparks the thread after the given number of nanoseconds if no other thread unparks it first. If the thread has been "preemptively unparked," this method cancels that unparking and returns immediately. This method may also return spuriously (that is, without the thread being told to unpark and without the indicated amount of time elapsing). <p>See {@link java.util.concurrent.locks.LockSupport} for more in-depth information of the behavior of this method.</p> <p>This method must only be called when <code>this</code> is the current thread. @param {Number} nanos number of nanoseconds to park for or <code>0</code> to park indefinitely @throws IllegalArgumentException thrown if <code>nanos < 0</code> @hide for Unsafe */ parkFor$ : function( ) {}, /**Parks the current thread until the specified system time. This method attempts to unpark the current thread immediately after <code>System.currentTimeMillis()</code> reaches the specified value, if no other thread unparks it first. If the thread has been "preemptively unparked," this method cancels that unparking and returns immediately. This method may also return spuriously (that is, without the thread being told to unpark and without the indicated amount of time elapsing). <p>See {@link java.util.concurrent.locks.LockSupport} for more in-depth information of the behavior of this method.</p> <p>This method must only be called when <code>this</code> is the current thread. @param {Number} time the time after which the thread should be unparked, in absolute milliseconds-since-the-epoch @hide for Unsafe */ parkUntil$ : function( ) {}, };