Home | Blog | Java | Jokes | Poems | Musings | Site Map | Kudos | Downloads | Useful Sites | Interesting | System Setup | Contact

Home Page

AKGBackup - The backup program

            

 

Threads

 


API for Thread class

Constructors:  

  • Thread ()

  • Thread (Runnable obj, String name)

  • Thread (Runnable obj)

  • Thread (String name)

  • Thread (ThreadGroup tg, Runnable obj)

  • Thread (ThreadGroup tg, Runnable obj, String name)

  • Thread (ThreadGroup tg, String name)

ThreadGroup versions throw SecurityException if the current thread cannot create a thread in the specified group. 

static methods:  

  • int activeCount ()

Returns the current number of active threads in this thread's thread group.

  • Thread currentThread ()

Returns a reference to the currently executing thread object.

  • void dumpStack ()

  • int enumerate (Thread [] t)

  • boolean interrupted ()

Tests whether the current thread has been interrupted. The interrupted status of the thread is cleared by this method. In other words, if this method were to be called twice in succession, the second call would return false (unless the current thread were interrupted again, after the first call had cleared its interrupted status and before the second call had examined it).

  • void sleep (long millis) throws InterruptedException

  • void sleep (long millis, int ns) throws InterruptedException

sleep () causes the currently executing thread to sleep (temporarily cease execution) for the specified number of milliseconds (and ns nanoseconds if specified). The thread does not lose ownership of any monitors. Throws InterruptedException if another thread has interrupted the current thread. The interrupted status of the current thread is cleared when this exception is thrown.

  • void yield ()

Causes the currently executing thread object to temporarily pause and allow other threads to execute. 

Instance methods:  

  • void checkAccess ()

  • void destroy ()

Destroys this thread, without any cleanup. Any monitors it has locked remain locked. (This method is not implemented.)

  • String getName ()

  • void setName (String name)

  • int getPriority ()

  • void setPriority (int priority)

  • ThreadGroup getThreadGroup ()

  • void interrupt ()

  • boolean isAlive ()

  • boolean isDaemon ()

  • boolean isInterrupted ()

Tests whether this thread has been interrupted. The interrupted status of the thread is unaffected by this method.

  • void join ()

  • void join (long millis)

Waits at most millis milliseconds for this thread to die. A timeout of 0 means to wait forever. Throws InterruptedException if another thread has interrupted the current thread. The interrupted of the current thread is cleared when this exception is thrown.

  • void join (long millis, int ns)

  • void run ()

If this thread was constructed using a separate Runnable object, then that Runnable objectís run method is called; otherwise, this method does nothing and returns.

  • void setDaemon (boolean on)

Marks this thread as either a daemon or a user thread. The JVM exits when the only threads running are all daemon threads. This method must be called before the thread is started.

  • void start ()

Causes this thread  to begin execution; the JVM calls the run method of this thread. The result is that two threads are running concurrently: the current thread (which returns from the call to the start () method) and the other thread (which executes its run () method). Throws IllegalThreadStateException if the thread was already started.

  • void resume () Deprecated

  • void stop ()  Deprecated

  • void suspend ()  Deprecated


section7-1 | section7-2 | section7-3 | section7-4 | section7-5

Sections : 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11

   

 

 

 

 

Home | Blog | Java | Jokes | Poems | Musings | Site Map | Kudos | Downloads | Useful Sites | Interesting | System Setup | Contact  

Loading

 Number of Pages viewed on this site since January' 2003 : Hit Counter eXTReMe Tracker

For any queries, comments or suggestions, write to me .

This site never compromises your privacy, please read this site's privacy policy.