org.wegra.thread
Class DaemonThread

java.lang.Object
  extended byjava.lang.Thread
      extended byorg.wegra.thread.DaemonThread
All Implemented Interfaces:
java.lang.Runnable

public final class DaemonThread
extends java.lang.Thread

¹ü¿ëÀûÀÎ µ¥¸ó ½º·¹µå·Î ÀÎÅÍ·´Æ® µÉ ¶§±îÁö "operation" °´Ã¼ÀÇ run() ¸Þ¼Òµå¸¦ ¹Ýº¹ÀûÀ¸·Î È£ÃâÇÑ´Ù. ÀÌ Å¬·¡½º¿¡¼­´Â ¿äûµÈ ÀÛ¾÷ÀÌ JVMÀÇ Á¹·á·Î ÀÎÇØ ¿¹±âÄ¡ ¾Ê°Ô ÇÔ²² Á¾·áµÇÁö ¾Êµµ·Ï º¸ÀåÇØÁØ´Ù. ¿¹¸¦ µé¾î, ´ÙÀ½ÀÇ ÄÚµå´Â 1ÃÊ¿¡ ÇÑ ¹ø¾¿ ½Ã°£À» Ãâ·ÂÇÑ´Ù. ½Ã°£ÀÌ Ãâ·ÂµÇ°í ÀÖ´Â »óȲ¿¡¼­´Â ÇÁ·Î±×·¥ÀÌ Á¾·áµÇÁö ¾ÊÀ¸¸ç ±× ¿ÜÀÇ °æ¿ì¶ó¸é Á¾·áµÉ ¼ö ÀÖ´Ù.

	new DeamonThread (
		new Runnable() {
			public void run() {
				System.out.println(new Date());
			}
		},
		new Runnable() {	// Áö¿¬ ½Ã°£
			public void run() {
				try {
					Thread.currentThread().sleep(1000);
				} catch (InterruptedException e) {}
			}
		}
 ).start();
 
Áö¿¬ ¸ñÀûÀÇ ÀÛ¾÷Àº ¿äûµÈ ÀÛ¾÷°ú ÇÔ²² ÀÛµ¿ÇÒ ¼ö ÀÖ´Ù´Â °Í¿¡ À¯ÀÇÇÏÀÚ.

Version:
1.0 (2001-07-26)
Author:
wegra (Bok-Youn Lee)

Nested Class Summary
static class DaemonThread.Test
          Å×½ºÆ®¿ë ³»ºÎ Ŭ·¡½º
 
Field Summary
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
DaemonThread(java.lang.Runnable operation, java.lang.Runnable delay)
           
 
Method Summary
 void run()
           
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setName, setPriority, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DaemonThread

public DaemonThread(java.lang.Runnable operation,
                    java.lang.Runnable delay)
Parameters:
operation - ½º·¹µå¿¡¼­ ½ÇÇàµÉ ÀÛ¾÷
delay - delayÀÇ run() ¸Þ¼Òµå´Â °¢ ¹Ýº¹¸¶´Ù È£ÃâµÈ´Ù. ¿©±â¿¡¼­´Â Thread.currentTime.interrupt() ¸¦ »ç¿ëÇØ µ¥¸ð ½º·¹µå¸¦ Á¾·áÇØ ÁÙ ¼öµµ ÀÖ´Ù.
Method Detail

run

public final void run()