JavaTM 2 Platform
Standard Ed. 5.0

java.util.concurrent
Ŭ·¡½º Executors

java.lang.Object 
  »óÀ§¸¦ È®Àå java.util.concurrent.Executors

public class Executors
extends Object

ÀÌ ÆÐÅ°Áö·Î Á¤ÀÇµÈ Executor, ExecutorService, ScheduledExecutorService, ThreadFactory ¹× Callable Ŭ·¡½º¿ëÀÇ ÆÑÅ丮 ¹× À¯Æ¿¸®Æ¼ ¸Þ¼­µå. ÀÌ Å¬·¡½º´Â ´ÙÀ½ÀÇ Á¾·ùÀÇ ¸Þ¼­µå¸¦ Áö¿ø ÇÕ´Ï´Ù.

µµÀÔµÈ ¹öÀü :
1.5

¸Þ¼­µå °³¿ä
static Callable <Object > callable (PrivilegedAction  action)
          È£Ãâ½Ã·Î ÁöÁ¤µÈ Ư±Ç ÷ºÎ ¾×¼ÇÀ» ½ÇÇàÇØ ±× °á°ú¸¦ µ¹·ÁÁÖ´Â Callable °´Ã¼¸¦ ¸®ÅÏÇÕ´Ï´Ù.
static Callable <Object > callable (PrivilegedExceptionAction  action)
          È£Ãâ½Ã·Î ÁöÁ¤µÈ Ư±Ç ÷ºÎ ¿¹¿Ü ¾×¼ÇÀ» ½ÇÇàÇØ ±× °á°ú¸¦ µ¹·ÁÁÖ´Â Callable °´Ã¼¸¦ ¸®ÅÏÇÕ´Ï´Ù.
static Callable <Object > callable (Runnable  task)
          È£Ãâ½Ã·Î ÁöÁ¤µÈ ŽºÅ©¸¦ ½ÇÇàÇØ nullÀ» µ¹·ÁÁÖ´Â Callable °´Ã¼¸¦ ¸®ÅÏÇÕ´Ï´Ù.
static
<T> Callable <T>
callable (Runnable  task, T result)
          È£Ãâ½Ã·Î ÁöÁ¤µÈ ŽºÅ©¸¦ ½ÇÇàÇØ, ÁöÁ¤µÈ °á°ú¸¦ µ¹·ÁÁÖ´Â Callable °´Ã¼¸¦ ¸®ÅÏÇÕ´Ï´Ù.
static ThreadFactory defaultThreadFactory ()
          »õ·Î¿î threadÀÇ ÀÛ¼º¿¡ »ç¿ëÇÏ´Â µðÆúÆ®ÀÇ thread ÆÑÅ丮¸¦ ¸®ÅÏÇÕ´Ï´Ù.
static ExecutorService newCachedThreadPool ()
          ÇÊ¿äÇÏ°Ô ÀÀÇØ »õ·Î¿î thread¸¦ ÀÛ¼ºÇÏ´Â thread Ç®À» ÀÛ¼ºÇÕ´Ï´Ù¸¸, ÀÌ¿ë °¡´ÉÇÑ °æ¿ì¿¡´Â ÀÌÀü¿¡ ±¸ÃàµÈ thread¸¦ ÀçÀÌ¿ëÇÕ´Ï´Ù.
static ExecutorService newCachedThreadPool (ThreadFactory  threadFactory)
          ÇÊ¿äÇÏ°Ô ÀÀÇØ »õ·Î¿î thread¸¦ ÀÛ¼ºÇÏ´Â thread Ç®À» ÀÛ¼ºÇÕ´Ï´Ù¸¸, ÀÌ¿ë °¡´ÉÇÑ °æ¿ì¿¡´Â ÀÌÀü¿¡ ±¸ÃàµÈ thread¸¦ ÀçÀÌ¿ëÇÕ´Ï´Ù.
static ExecutorService newFixedThreadPool (int nThreads)
          °øÀ¯ ¾È ¹Ù¿îµå Çü½ÄÀÇ Å¥¾øÀÌ µ¿ÀÛÇÏ´Â °íÁ¤ ¼¼Æ®ÀÇ thread¸¦ ÀçÀÌ¿ëÇÏ´Â thread Ç®À» ÀÛ¼ºÇÕ´Ï´Ù.
static ExecutorService newFixedThreadPool (int nThreads, ThreadFactory  threadFactory)
          °øÀ¯ ¾È ¹Ù¿îµå Çü½ÄÀÇ Å¥¾øÀÌ µ¿ÀÛÇÏ´Â °íÁ¤ ¼¼Æ®ÀÇ thread¸¦ ÀçÀÌ¿ëÇÏ´Â thread Ç®À» ÀÛ¼ºÇÕ´Ï´Ù.
static ScheduledExecutorService newScheduledThreadPool (int corePoolSize)
          ÁöÁ¤µÈ Áö¿¬ ½Ã°£ ÈÄ, ¶Ç´Â ÁÖ±âÀûÀ¸·Î Ä¿¸àµåÀÇ ½ÇÇàÀ» ½ºÄÉÁÙ °¡´ÉÇÑ thread Ç®À» ÀÛ¼ºÇÕ´Ï´Ù.
static ScheduledExecutorService newScheduledThreadPool (int corePoolSize, ThreadFactory  threadFactory)
          ÁöÁ¤µÈ Áö¿¬ ½Ã°£ ÈÄ, ¶Ç´Â ÁÖ±âÀûÀ¸·Î Ä¿¸àµåÀÇ ½ÇÇàÀ» ½ºÄÉÁÙ °¡´ÉÇÑ thread Ç®À» ÀÛ¼ºÇÕ´Ï´Ù.
static ExecutorService newSingleThreadExecutor ()
          ¾È ¹Ù¿îµå Çü½ÄÀÇ Å¥¾øÀÌ µ¿ÀÛÇÏ´Â ´ÜÀÏÀÇ ¿öÅ©½º ·¹µå¸¦ »ç¿ëÇÏ´Â Executor¸¦ ÀÛ¼ºÇÕ´Ï´Ù (´Ù¸¸, ½ÇÇàÁß¿¡ ¹ß»ýÇÑ ÀåÇØÀ̱⠶§¹®¿¡ ÀÌ ´ÜÀÏ thread°¡ ¼Ë´Ù¿îÀü¿¡ Á¾·áÇßÀ» °æ¿ì¿¡´Â ÇÊ¿ä¿¡ µû¶ó¼­ »õ·Î¿î thread°¡ »ó¼ÓÇØ ÈļÓÀÇ Å½ºÅ©¸¦ ½ÇÇàÇÑ´Ù).
static ExecutorService newSingleThreadExecutor (ThreadFactory  threadFactory)
          ¾È ¹Ù¿îµå Çü½ÄÀÇ Å¥¾øÀÌ µ¿ÀÛÇÏ´Â ´ÜÀÏÀÇ ¿öÅ©½º ·¹µå¸¦ »ç¿ëÇÏ´Â Executor¸¦ ÀÛ¼ºÇÕ´Ï´Ù.
static ScheduledExecutorService newSingleThreadScheduledExecutor ()
          ÁöÁ¤µÈ Áö¿¬ ½Ã°£ ÈÄ, ¶Ç´Â ÁÖ±âÀûÀ¸·Î Ä¿¸àµåÀÇ ½ÇÇàÀ» ½ºÄÉÁÙ °¡´ÉÇÑ, ´ÜÀÏ threadÀÇ executor¸¦ ÀÛ¼ºÇÕ´Ï´Ù.
static ScheduledExecutorService newSingleThreadScheduledExecutor (ThreadFactory  threadFactory)
          ÁöÁ¤µÈ Áö¿¬ ½Ã°£ ÈÄ, ¶Ç´Â ÁÖ±âÀûÀ¸·Î Ä¿¸àµåÀÇ ½ÇÇàÀ» ½ºÄÉÁÙ °¡´ÉÇÑ, ´ÜÀÏ threadÀÇ executor¸¦ ÀÛ¼ºÇÕ´Ï´Ù.
static
<T> Callable <T>
privilegedCallable (Callable <T> callable)
          È£Ãâ½Ã¿¡ ÇöÀçÀÇ ¾×¼¼½º Á¦¾î ÄÁÅؽºÆ®¿¡ µû¶ó ÁöÁ¤µÈ callable¸¦ ½ÇÇàÇÏ´Â Callable °´Ã¼¸¦ ¸®ÅÏÇÕ´Ï´Ù.
static
<T> Callable <T>
privilegedCallableUsingCurrentClassLoader (Callable <T> callable)
          È£Ãâ½Ã¿¡ ÇöÀçÀÇ ¾×¼¼½º Á¦¾î ÄÁÅؽºÆ®¿¡ µû¶ó, ÇöÀçÀÇ ÄÁÅؽºÆ® Ŭ·¡½º ·Î´õ¸¦ ÄÁÅؽºÆ® Ŭ·¡½º ·Î´õ·Î ÇÏ´Â ÁöÁ¤µÈ callable¸¦ ½ÇÇàÇÏ´Â Callable °´Ã¼¸¦ ¸®ÅÏÇÕ´Ï´Ù.
static ThreadFactory privilegedThreadFactory ()
          ÇöÀçÀÇ thread¿Í °°Àº Á¢±Ù ±ÇÇÑÀ» °¡Áö´Â »õ·Î¿î thread¸¦ ÀÛ¼ºÇϱâ À§Çؼ­ »ç¿ëÇÏ´Â thread ÆÑÅ丮¸¦ ¸®ÅÏÇÕ´Ï´Ù.
static ExecutorService unconfigurableExecutorService (ExecutorService  executor)
          Á¤ÀÇ ³¡³­ ExecutorService ¸Þ¼­µå¸¦ ¸ðµÎ ÁöÁ¤µÈ executor¿¡ À§¾ç ÇÏÁö¸¸, ij½ºÆ®¸¦ »ç¿ëÇØ ¾×¼¼½º °¡´ÉÇÑ ´Ù¸¥ ¸Þ¼­µå´Â À§¾ç ÇÏÁö ¾Ê´Â °´Ã¼¸¦ ¸®ÅÏÇÕ´Ï´Ù.
static ScheduledExecutorService unconfigurableScheduledExecutorService (ScheduledExecutorService  executor)
          Á¤ÀÇ ³¡³­ ScheduledExecutorService ¸Þ¼­µå¸¦ ¸ðµÎ ÁöÁ¤µÈ executor¿¡ À§¾ç ÇÏÁö¸¸, ij½ºÆ®¸¦ »ç¿ëÇØ ¾×¼¼½º °¡´ÉÇÑ ´Ù¸¥ ¸Þ¼­µå´Â À§¾ç ÇÏÁö ¾Ê´Â °´Ã¼¸¦ ¸®ÅÏÇÕ´Ï´Ù.
 
Ŭ·¡½º java.lang. Object ·ÎºÎÅÍ »ó¼ÓµÈ ¸Þ¼­µå
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

¸Þ¼­µåÀÇ »ó¼¼

newFixedThreadPool

public static ExecutorService  newFixedThreadPool(int nThreads)
°øÀ¯ ¾È ¹Ù¿îµå Çü½ÄÀÇ Å¥¾øÀÌ µ¿ÀÛÇÏ´Â °íÁ¤ ¼¼Æ®ÀÇ thread¸¦ ÀçÀÌ¿ëÇÏ´Â thread Ç®À» ÀÛ¼ºÇÕ´Ï´Ù. ½ÇÇàÁß¿¡ ¹ß»ýÇÑ ÀåÇØÀ̱⠶§¹®¿¡ ¸î°³ÀÇ thread°¡ ¼Ë´Ù¿îÀü¿¡ Á¾·áÇßÀ» °æ¿ì¿¡´Â ÇÊ¿ä¿¡ µû¶ó¼­ »õ·Î¿î thread°¡ »ó¼ÓÇØ ÈļÓÀÇ Å½ºÅ©¸¦ ½ÇÇàÇÕ´Ï´Ù.

ÆĶó¹ÌÅÍ:
nThreads - Ç®³»ÀÇ thread¼ö
¹Ýȯ°ª:
»õ·Î¿î ÀÛ¼ºµÈ thread Ç®

newFixedThreadPool

public static ExecutorService  newFixedThreadPool(int nThreads,
                                                 ThreadFactory  threadFactory)
°øÀ¯ ¾È ¹Ù¿îµå Çü½ÄÀÇ Å¥¾øÀÌ µ¿ÀÛÇÏ´Â °íÁ¤ ¼¼Æ®ÀÇ thread¸¦ ÀçÀÌ¿ëÇÏ´Â thread Ç®À» ÀÛ¼ºÇÕ´Ï´Ù. ÇÊ¿äÇÏ°Ô ÀÀÇØ ÁöÁ¤µÈ ThreadFactory¸¦ »ç¿ëÇØ »õ·Î¿î thread¸¦ ÀÛ¼ºÇÕ´Ï´Ù.

ÆĶó¹ÌÅÍ:
nThreads - Ç®³»ÀÇ thread¼ö
threadFactory - »õ·Î¿î thread ÀÛ¼º½Ã¿¡ »ç¿ëÇÏ´Â ÆÑÅ丮
¹Ýȯ°ª:
»õ·Î¿î ÀÛ¼ºµÈ thread Ç®

newSingleThreadExecutor

public static ExecutorService  newSingleThreadExecutor()
¾È ¹Ù¿îµå Çü½ÄÀÇ Å¥¾øÀÌ µ¿ÀÛÇÏ´Â ´ÜÀÏÀÇ ¿öÅ©½º ·¹µå¸¦ »ç¿ëÇÏ´Â Executor¸¦ ÀÛ¼ºÇÕ´Ï´Ù (´Ù¸¸, ½ÇÇàÁß¿¡ ¹ß»ýÇÑ ÀåÇØÀ̱⠶§¹®¿¡ ÀÌ ´ÜÀÏ thread°¡ ¼Ë´Ù¿îÀü¿¡ Á¾·áÇßÀ» °æ¿ì¿¡´Â ÇÊ¿ä¿¡ µû¶ó¼­ »õ·Î¿î thread°¡ »ó¼ÓÇØ ÈļÓÀÇ Å½ºÅ©¸¦ ½ÇÇàÇÑ´Ù). ŽºÅ©°¡ Â÷·Ê·Î ½ÇÇàµÇ´Â °Í ¹× ¾î´À ½ÃÁ¡¿¡ À־ º¹¼öÀÇ Å½ºÅ©°¡ È°¼ºÈ­ µÉ °ÍÀº ¾ø´Â °ÍÀÌ º¸ÁõµË´Ï´Ù. ´Ù¸¥ Á¡À¸·Î½á µî°¡ÀÎ newFixedThreadPool(1) °ú´Â ´Þ¸®, ¸®ÅÏµÈ executor ¿¡¼­´Â º¹±¸¼º¿¡ ÇÑ threadÀÇ Ãß°¡ »ç¿ëÀº ºÒ°¡´ÉÇÏ´Ù¶ó°í ÇÏ´Â °ÍÀÌ º¸ÁõµÇ°í ÀÖ½À´Ï´Ù.

¹Ýȯ°ª:
»õ·Î¿î ÀÛ¼ºµÈ ´ÜÀÏ threadÀÇ Executor

newSingleThreadExecutor

public static ExecutorService  newSingleThreadExecutor(ThreadFactory  threadFactory)
¾È ¹Ù¿îµå Çü½ÄÀÇ Å¥¾øÀÌ µ¿ÀÛÇÏ´Â ´ÜÀÏÀÇ ¿öÅ©½º ·¹µå¸¦ »ç¿ëÇÏ´Â Executor¸¦ ÀÛ¼ºÇÕ´Ï´Ù. ÇÊ¿ä¿¡ µû¶ó¼­, ÁöÁ¤µÈ ThreadFactory¸¦ »ç¿ëÇØ »õ·Î¿î thread¸¦ ÀÛ¼ºÇÕ´Ï´Ù. ´Ù¸¥ Á¡À¸·Î½á µî°¡ÀÎ newFixedThreadPool(1, threadFactory) °ú´Â ´Þ¸®, ¸®ÅÏµÈ executor ¿¡¼­´Â º¹±¸¼º¿¡ ÇÑ threadÀÇ Ãß°¡ »ç¿ëÀº ºÒ°¡´ÉÇÏ´Ù¶ó°í ÇÏ´Â °ÍÀÌ º¸ÁõµÇ°í ÀÖ½À´Ï´Ù.

ÆĶó¹ÌÅÍ:
threadFactory - »õ·Î¿î thread ÀÛ¼º½Ã¿¡ »ç¿ëÇÏ´Â ÆÑÅ丮
¹Ýȯ°ª:
»õ·Î¿î ÀÛ¼ºµÈ ´ÜÀÏ threadÀÇ Executor

newCachedThreadPool

public static ExecutorService  newCachedThreadPool()
ÇÊ¿äÇÏ°Ô ÀÀÇØ »õ·Î¿î thread¸¦ ÀÛ¼ºÇÏ´Â thread Ç®À» ÀÛ¼ºÇÕ´Ï´Ù¸¸, ÀÌ¿ë °¡´ÉÇÑ °æ¿ì¿¡´Â ÀÌÀü¿¡ ±¸ÃàµÈ thread¸¦ ÀçÀÌ¿ëÇÕ´Ï´Ù. º¸Åë, Ç®Àº ´Ü±âÀÇ ºñµ¿±â ŽºÅ©¸¦ ´Ù¼ö ½ÇÇàÇÏ´Â ÇÁ·Î±×·¥ÀÇ ÆÛÆ÷¸Õ½º¸¦ °³¼±ÇÕ´Ï´Ù. execute¸¦ È£ÃâÇϸé, ÀÌÀü¿¡ ±¸ÃàµÈ thread°¡ ÀÌ¿ë °¡´ÉÇϸé, ±×°ÍÀ» ÀçÀÌ¿ëÇÕ´Ï´Ù. ±âÁ¸ÀÇ thread¸¦ ÀÌ¿ëÇÒ ¼ö ¾ø´Â °æ¿ì´Â »õ·Î¿î thread°¡ ÀÛ¼ºµÇ¾î, Ç®¿¡ Ãß°¡µË´Ï´Ù. 60 ÃÊ°£ »ç¿ëµÇÁö ¾Ê¾Ò´ø thread´Â Á¾·áÇØ, ij½¬·ÎºÎÅÍ »èÁ¦µË´Ï´Ù. ÀÌ ¶§¹®¿¡ ¿À·§µ¿¾ÈÀÚ½Ä µ¹ »óÅÂÀÇ Ç®¿¡ ÀÇÇØ ÀÚ¿øÀÌ ¼ÒºñµÉ °ÍÀº ¾ø½À´Ï´Ù. À¯»çÇÑ ÇÁ·ÎÆÛƼ¸¦ °¡ÁöÁö¸¸, »ó¼¼ÇÑ ´Ù¸¥ Ç® (timeout ÆĶó¹ÌÅ͵î)Àº, ThreadPoolExecutor »ý¼ºÀÚ¸¦ »ç¿ëÇØ ÀÛ¼ºÇÒ ¼ö ÀÖ½À´Ï´Ù.

¹Ýȯ°ª:
»õ·Î¿î ÀÛ¼ºµÈ thread Ç®

newCachedThreadPool

public static ExecutorService  newCachedThreadPool(ThreadFactory  threadFactory)
ÇÊ¿äÇÏ°Ô ÀÀÇØ »õ·Î¿î thread¸¦ ÀÛ¼ºÇÏ´Â thread Ç®À» ÀÛ¼ºÇÕ´Ï´Ù¸¸, ÀÌ¿ë °¡´ÉÇÑ °æ¿ì¿¡´Â ÀÌÀü¿¡ ±¸ÃàµÈ thread¸¦ ÀçÀÌ¿ëÇÕ´Ï´Ù. ¶Ç, ÇÊ¿äÇÏ°Ô ÀÀÇØ ÁöÁ¤µÈ ThreadFactory¸¦ »ç¿ëÇØ »õ·Î¿î thread¸¦ ÀÛ¼ºÇÕ´Ï´Ù.

ÆĶó¹ÌÅÍ:
threadFactory - »õ·Î¿î thread ÀÛ¼º½Ã¿¡ »ç¿ëÇÏ´Â ÆÑÅ丮
¹Ýȯ°ª:
»õ·Î¿î ÀÛ¼ºµÈ thread Ç®

newSingleThreadScheduledExecutor

public static ScheduledExecutorService  newSingleThreadScheduledExecutor()
ÁöÁ¤µÈ Áö¿¬ ½Ã°£ ÈÄ, ¶Ç´Â ÁÖ±âÀûÀ¸·Î Ä¿¸àµåÀÇ ½ÇÇàÀ» ½ºÄÉÁÙ °¡´ÉÇÑ, ´ÜÀÏ threadÀÇ executor¸¦ ÀÛ¼ºÇÕ´Ï´Ù. (´Ù¸¸, ½ÇÇàÁß¿¡ ¹ß»ýÇÑ ÀåÇØÀ̱⠶§¹®¿¡ ÀÌ ´ÜÀÏ thread°¡ ¼Ë´Ù¿îÀü¿¡ Á¾·áÇßÀ» °æ¿ì¿¡´Â ÇÊ¿ä¿¡ µû¶ó¼­ »õ·Î¿î thread°¡ »ó¼ÓÇØ ÈļÓÀÇ Å½ºÅ©¸¦ ½ÇÇàÇÑ´Ù). ŽºÅ©°¡ Â÷·Ê·Î ½ÇÇàµÇ´Â °Í ¹× ¾î´À ½ÃÁ¡¿¡ À־ º¹¼öÀÇ Å½ºÅ©°¡ È°¼ºÈ­ µÉ °ÍÀº ¾ø´Â °ÍÀÌ º¸ÁõµË´Ï´Ù. ´Ù¸¥ Á¡À¸·Î½á µî°¡ÀÎ newScheduledThreadPool(1) °ú´Â ´Þ¸®, ¸®ÅÏµÈ executor ¿¡¼­´Â º¹±¸¼º¿¡ ÇÑ threadÀÇ Ãß°¡ »ç¿ëÀº ºÒ°¡´ÉÇÏ´Ù¶ó°í ÇÏ´Â °ÍÀÌ º¸ÁõµÇ°í ÀÖ½À´Ï´Ù.

¹Ýȯ°ª:
»õ·Î¿î ÀÛ¼ºµÈ ½ºÄÉÁÙ ³¡³­ executor

newSingleThreadScheduledExecutor

public static ScheduledExecutorService  newSingleThreadScheduledExecutor(ThreadFactory  threadFactory)
ÁöÁ¤µÈ Áö¿¬ ½Ã°£ ÈÄ, ¶Ç´Â ÁÖ±âÀûÀ¸·Î Ä¿¸àµåÀÇ ½ÇÇàÀ» ½ºÄÉÁÙ °¡´ÉÇÑ, ´ÜÀÏ threadÀÇ executor¸¦ ÀÛ¼ºÇÕ´Ï´Ù. (´Ù¸¸, ½ÇÇàÁß¿¡ ¹ß»ýÇÑ ÀåÇØÀ̱⠶§¹®¿¡ ÀÌ ´ÜÀÏ thread°¡ ¼Ë´Ù¿îÀü¿¡ Á¾·áÇßÀ» °æ¿ì¿¡´Â ÇÊ¿ä¿¡ µû¶ó¼­ »õ·Î¿î thread°¡ »ó¼ÓÇØ ÈļÓÀÇ Å½ºÅ©¸¦ ½ÇÇàÇÑ´Ù). ŽºÅ©°¡ Â÷·Ê·Î ½ÇÇàµÇ´Â °Í ¹× ¾î´À ½ÃÁ¡¿¡ À־ º¹¼öÀÇ Å½ºÅ©°¡ È°¼ºÈ­ µÉ °ÍÀº ¾ø´Â °ÍÀÌ º¸ÁõµË´Ï´Ù. ´Ù¸¥ Á¡À¸·Î½á µî°¡ÀÎ newScheduledThreadPool(1, threadFactory) °ú´Â ´Þ¸®, ¸®ÅÏµÈ executor ¿¡¼­´Â º¹±¸¼º¿¡ ÇÑ threadÀÇ Ãß°¡ »ç¿ëÀº ºÒ°¡´ÉÇÏ´Ù¶ó°í ÇÏ´Â °ÍÀÌ º¸ÁõµÇ°í ÀÖ½À´Ï´Ù.

ÆĶó¹ÌÅÍ:
threadFactory - »õ·Î¿î thread ÀÛ¼º½Ã¿¡ »ç¿ëÇÏ´Â ÆÑÅ丮
¹Ýȯ°ª:
»õ·Î¿î ÀÛ¼ºµÈ ½ºÄÉÁÙ ³¡³­ executor

newScheduledThreadPool

public static ScheduledExecutorService  newScheduledThreadPool(int corePoolSize)
ÁöÁ¤µÈ Áö¿¬ ½Ã°£ ÈÄ, ¶Ç´Â ÁÖ±âÀûÀ¸·Î Ä¿¸àµåÀÇ ½ÇÇàÀ» ½ºÄÉÁÙ °¡´ÉÇÑ thread Ç®À» ÀÛ¼ºÇÕ´Ï´Ù.

ÆĶó¹ÌÅÍ:
corePoolSize - Ç®³» ·Î À¯ÁöÇÏ´Â threadÀÇ ¼ö (¾ÆÀ̵¹ »óÅÂÀÇ threadµµ Æ÷ÇÔÇÑ´Ù)
¹Ýȯ°ª:
»õ·Î¿î ÀÛ¼ºµÈ ½ºÄÉÁÙ ³¡³­ thread Ç®

newScheduledThreadPool

public static ScheduledExecutorService  newScheduledThreadPool(int corePoolSize,
                                                              ThreadFactory  threadFactory)
ÁöÁ¤µÈ Áö¿¬ ½Ã°£ ÈÄ, ¶Ç´Â ÁÖ±âÀûÀ¸·Î Ä¿¸àµåÀÇ ½ÇÇàÀ» ½ºÄÉÁÙ °¡´ÉÇÑ thread Ç®À» ÀÛ¼ºÇÕ´Ï´Ù.

ÆĶó¹ÌÅÍ:
corePoolSize - Ç®³» ·Î À¯ÁöÇÏ´Â threadÀÇ ¼ö (¾ÆÀ̵¹ »óÅÂÀÇ threadµµ Æ÷ÇÔÇÑ´Ù)
threadFactory - executor°¡ »õ·Î¿î thread¸¦ ÀÛ¼ºÇÒ ¶§¿¡ »ç¿ëÇÏ´Â ÆÑÅ丮
¹Ýȯ°ª:
»õ·Î¿î ÀÛ¼ºµÈ ½ºÄÉÁÙ ³¡³­ thread Ç®

unconfigurableExecutorService

public static ExecutorService  unconfigurableExecutorService(ExecutorService  executor)
Á¤ÀÇ ³¡³­ ExecutorService ¸Þ¼­µå¸¦ ¸ðµÎ ÁöÁ¤µÈ executor¿¡ À§¾ç ÇÏÁö¸¸, ij½ºÆ®¸¦ »ç¿ëÇØ ¾×¼¼½º °¡´ÉÇÑ ´Ù¸¥ ¸Þ¼­µå´Â À§¾ç ÇÏÁö ¾Ê´Â °´Ã¼¸¦ ¸®ÅÏÇÕ´Ï´Ù. ÀÌ°ÍÀ» »ç¿ëÇϸé, ±¸¼ºÀ» ¾ÈÀüÇÏ°Ô ¡¸freeze¡¹Çϸ鼭, ÁöÁ¤µÈ ±¸»ó ±¸ÇöÀÇ Æ©´×À» Çã°¡ÇÏÁö ¾Ê°Ô ÇÒ ¼ö ÀÖ½À´Ï´Ù.

ÆĶó¹ÌÅÍ:
executor - ±âº»À¸·Î µÇ´Â ±¸Çö
¹Ýȯ°ª:
ExecutorService ÀνºÅϽº
¿¹¿Ü:
NullPointerException - executor°¡ nullÀÎ °æ¿ì

unconfigurableScheduledExecutorService

public static ScheduledExecutorService  unconfigurableScheduledExecutorService(ScheduledExecutorService  executor)
Á¤ÀÇ ³¡³­ ScheduledExecutorService ¸Þ¼­µå¸¦ ¸ðµÎ ÁöÁ¤µÈ executor¿¡ À§¾ç ÇÏÁö¸¸, ij½ºÆ®¸¦ »ç¿ëÇØ ¾×¼¼½º °¡´ÉÇÑ ´Ù¸¥ ¸Þ¼­µå´Â À§¾ç ÇÏÁö ¾Ê´Â °´Ã¼¸¦ ¸®ÅÏÇÕ´Ï´Ù. ÀÌ°ÍÀ» »ç¿ëÇϸé, ±¸¼ºÀ» ¾ÈÀüÇÏ°Ô ¡¸freeze¡¹Çϸ鼭, ÁöÁ¤µÈ ±¸»ó ±¸ÇöÀÇ Æ©´×À» Çã°¡ÇÏÁö ¾Ê°Ô ÇÒ ¼ö ÀÖ½À´Ï´Ù.

ÆĶó¹ÌÅÍ:
executor - ±âº»À¸·Î µÇ´Â ±¸Çö
¹Ýȯ°ª:
ScheduledExecutorService ÀνºÅϽº
¿¹¿Ü:
NullPointerException - executor°¡ nullÀÎ °æ¿ì

defaultThreadFactory

public static ThreadFactory  defaultThreadFactory()
»õ·Î¿î threadÀÇ ÀÛ¼º¿¡ »ç¿ëÇÏ´Â µðÆúÆ®ÀÇ thread ÆÑÅ丮¸¦ ¸®ÅÏÇÕ´Ï´Ù. ÀÌ ÆÑÅ丮´Â °°Àº ThreadGroup ³»ÀÇ Executor°¡ »ç¿ëÇÏ´Â »õ·Î¿î thread¸¦ ¸ðµÎ ÀÛ¼ºÇÕ´Ï´Ù. SecurityManager °¡ Á¸ÀçÇÏ´Â °æ¿ì, System.getSecurityManager() ±×·ìÀÌ »ç¿ëµÇ¾î Á¸ÀçÇÏÁö ¾Ê´Â °æ¿ì´Â ÀÌ defaultThreadFactory ¸Þ¼­µå¸¦ È£ÃâÇÏ´Â thread ±×·ìÀÌ »ç¿ëµË´Ï´Ù. °¢ »õ·Î¿î thread´Â ¿ì¼± ¼øÀ§ Thread.NORM_PRIORITY¸¦ °¡Áö´Â ºñdemon thread·Î¼­ ÀÛ¼ºµË´Ï´Ù. »õ·Î¿î thread´Â pool-N-thread-M Thread.getName()¸¦ °³ÀÔ½ÃÄÑ ¾×¼¼½º °¡´ÉÇÑ À̸§À» °¡Áý´Ï´Ù. ¿©±â¼­, N´Â ÀÌ ÆÑÅ丮ÀÇ ÀÏ·Ã ¹øÈ£, M´Â ÀÌ ÆÑÅ丮¿¡ ÀÇÇØ ÀÛ¼ºµÈ threadÀÇ ÀÏ·Ã ¹øÈ£¸¦ÀǹÌÇÕ´Ï´Ù.

¹Ýȯ°ª:
thread ÆÑÅ丮

privilegedThreadFactory

public static ThreadFactory  privilegedThreadFactory()
ÇöÀçÀÇ thread¿Í °°Àº Á¢±Ù ±ÇÇÑÀ» °¡Áö´Â »õ·Î¿î thread¸¦ ÀÛ¼ºÇϱâ À§Çؼ­ »ç¿ëÇÏ´Â thread ÆÑÅ丮¸¦ ¸®ÅÏÇÕ´Ï´Ù. ÀÌ ÆÑÅ丮´Â defaultThreadFactory() ¿Í °°Àº ¼³Á¤À» °¡Áö´Â thread¸¦ ÀÛ¼ºÇÕ´Ï´Ù. ¶Ç, »õ·Î¿î threadÀÇ AccessControlContext ¹× contextClassLoader¸¦, ÀÌ privilegedThreadFactory ¸Þ¼­µå¸¦ È£ÃâÇÏ´Â thread¿Í °°°Ô ¼³Á¤ÇÕ´Ï´Ù. »õ·Î¿î privilegedThreadFactory´Â AccessController.doPrivileged(java.security.PrivilegedAction) ¾×¼Ç³»¿¡¼­ ÀÛ¼ºÇÒ ¼ö ÀÖ½À´Ï´Ù. ±× ¶§, ÇöÀçÀÇ threadÀÇ ¾×¼¼½º Á¦¾î ÄÁÅؽºÆ®¸¦ ¼³Á¤ÇØ, ¾×¼Ç³»¿¡ ¼±ÅÃÇÑ Á¢±Ù ±ÇÇÑ ¼³Á¤À» º¸°ü À¯ÁöÇÏ´Â thread¸¦ ÀÛ¼ºÇÕ´Ï´Ù.

ÀÌ·± Á¾·ùÀÇ thread³»¿¡¼­ ½ÇÇàÁßÀÇ Å½ºÅ©´Â ÇöÀçÀÇ thread¿Í °°Àº ¾×¼¼½º Á¦¾î ¹× Ŭ·¡½º ·Î´õ¸¦ º¸°ü À¯ÁöÇÕ´Ï´Ù¸¸, °°Àº ThreadLocal ³ª InheritableThreadLocal Ä¡¸¦ º¸°ü À¯ÁöÇÒ ÇÊ¿ä´Â ¾ø½À´Ï´Ù. ThreadPoolExecutor.beforeExecute(java.lang.Thread, java.lang.Runnable)¸¦ »ç¿ëÇØ ThreadPoolExecutor ¼­ºê Ŭ·¡½º³»¿¡¼­ ŽºÅ©¸¦ ½ÇÇàÇϱâ Àü¿¡ ÇÊ¿äÇÏ°Ô ÀÀÇØ thread ·ÎÄÉÀÏÀÇ Æ¯Á¤ÀÇ °ªÀ» ¼³Á¤ ¶Ç´Â ¸®¼Â ÇÒ ¼ö ÀÖ½À´Ï´Ù. ¶Ç, ¿öÅ©½º ·¹µå¸¦ ÃʱâÈ­ÇØ, ´Ù¸¥ ÁöÁ¤µÈ thread¿Í °°Àº InheritableThreadLocal ¼³Á¤À¸·Î ÇÏ´Â °ÍÀÌ ÇÊ¿äÇÑ °æ¿ì, Ä¿½ºÅÒ ThreadFactory¸¦ ÀÛ¼ºÇØ, thread°¡ ±× ³»ºÎ¿¡¼­ °ªÀ» »ó¼ÓÇÏ´Â ´Ù¸¥ threadÀÇ ÀÛ¼ºÀ» ´ë±âÇØ, ¼­ºñ½º°¡ ±×°ÍÀ» ¿ä±¸Çϵµ·Ï ÇÒ ¼ö ÀÖ½À´Ï´Ù.

¹Ýȯ°ª:
thread ÆÑÅ丮
¿¹¿Ü:
AccessControlException - ÇöÀçÀÇ ¾×¼¼½º Á¦¾î ÄÁÅؽºÆ®ÀÌ, ÄÁÅؽºÆ® Ŭ·¡½º ·Î´õÀÇ Ãëµæ°ú ¼³Á¤ÀÇ ¾çÂÊ ¸ðµÎÀÇ Á¢±Ù ±ÇÇÑÀ» º¸°ü À¯ÁöÇÏÁö ¾Ê´Â °æ¿ì

callable

public static <T> Callable <T> callable(Runnable  task,
                                       T result)
È£Ãâ½Ã·Î ÁöÁ¤µÈ ŽºÅ©¸¦ ½ÇÇàÇØ, ÁöÁ¤µÈ °á°ú¸¦ µ¹·ÁÁÖ´Â Callable °´Ã¼¸¦ ¸®ÅÏÇÕ´Ï´Ù. ÀÌ°ÍÀº, Callable¸¦ ÇÊ¿ä·Î ÇÏ´Â ¸Þ¼­µå¸¦, ´Ù¸¥ ¹æ¹ý¿¡¼­´Â °á°úÀÇ ³ª¿ÀÁö ¾Ê´Â ¾×¼Ç¿¡ Àû¿ëÇÏ´Â °æ¿ì¿¡ µµ¿òÀÌ µË´Ï´Ù.

ÆĶó¹ÌÅÍ:
task - ½ÇÇàÇϴ ŽºÅ©
result - µ¹·ÁÁÖ´Â °á°ú
¹Ýȯ°ª:
È£ÃâÇØ °¡´ÉÇÑ °´Ã¼
¿¹¿Ü:
NullPointerException - ŽºÅ©°¡ nullÀÎ °æ¿ì

callable

public static Callable <Object > callable(Runnable  task)
È£Ãâ½Ã·Î ÁöÁ¤µÈ ŽºÅ©¸¦ ½ÇÇàÇØ nullÀ» µ¹·ÁÁÖ´Â Callable °´Ã¼¸¦ ¸®ÅÏÇÕ´Ï´Ù.

ÆĶó¹ÌÅÍ:
task - ½ÇÇàÇϴ ŽºÅ©
¹Ýȯ°ª:
È£ÃâÇØ °¡´ÉÇÑ °´Ã¼
¿¹¿Ü:
NullPointerException - ŽºÅ©°¡ nullÀÎ °æ¿ì

callable

public static Callable <Object > callable(PrivilegedAction  action)
È£Ãâ½Ã·Î ÁöÁ¤µÈ Ư±Ç ÷ºÎ ¾×¼ÇÀ» ½ÇÇàÇØ ±× °á°ú¸¦ µ¹·ÁÁÖ´Â Callable °´Ã¼¸¦ ¸®ÅÏÇÕ´Ï´Ù.

ÆĶó¹ÌÅÍ:
action - ½ÇÇàÇϴ Ư±Ç ÷ºÎ ¾×¼Ç
¹Ýȯ°ª:
È£ÃâÇØ °¡´ÉÇÑ °´Ã¼
¿¹¿Ü:
NullPointerException - ¾×¼ÇÀÌ nullÀÎ °æ¿ì

callable

public static Callable <Object > callable(PrivilegedExceptionAction  action)
È£Ãâ½Ã·Î ÁöÁ¤µÈ Ư±Ç ÷ºÎ ¿¹¿Ü ¾×¼ÇÀ» ½ÇÇàÇØ ±× °á°ú¸¦ µ¹·ÁÁÖ´Â Callable °´Ã¼¸¦ ¸®ÅÏÇÕ´Ï´Ù.

ÆĶó¹ÌÅÍ:
action - ½ÇÇàÇϴ Ư±Ç ÷ºÎ ¿¹¿Ü ¾×¼Ç
¹Ýȯ°ª:
È£ÃâÇØ °¡´ÉÇÑ °´Ã¼
¿¹¿Ü:
NullPointerException - ¾×¼ÇÀÌ nullÀÎ °æ¿ì

privilegedCallable

public static <T> Callable <T> privilegedCallable(Callable <T> callable)
È£Ãâ½Ã¿¡ ÇöÀçÀÇ ¾×¼¼½º Á¦¾î ÄÁÅؽºÆ®¿¡ µû¶ó ÁöÁ¤µÈ callable¸¦ ½ÇÇàÇÏ´Â Callable °´Ã¼¸¦ ¸®ÅÏÇÕ´Ï´Ù. º¸Åë, ÀÌ ¸Þ¼­µå´Â AccessController.doPrivileged(java.security.PrivilegedAction) ¾×¼Ç³»¿¡¼­ ºÒ·Á°¡ callable¸¦ ÀÛ¼ºÇϵµ·Ï ÇÕ´Ï´Ù. callable´Â °¡´ÉÇÏ¸é ±× ¾×¼Ç³»ÀÇ ¼±ÅÃÇÑ Á¢±Ù ±ÇÇÑ ¼³Á¤¿¡ µû¶ó ½ÇÇàÇØ, °¡´ÉÇÏÁö ¾ÊÀ¸¸é °ü·ÃµÈ AccessControlException¸¦ Throw ÇÕ´Ï´Ù.

ÆĶó¹ÌÅÍ:
callable - ±âº»À¸·Î µÇ´Â ŽºÅ©
¹Ýȯ°ª:
È£ÃâÇØ °¡´ÉÇÑ °´Ã¼
¿¹¿Ü:
NullPointerException - callable°¡ nullÀÎ °æ¿ì

privilegedCallableUsingCurrentClassLoader

public static <T> Callable <T> privilegedCallableUsingCurrentClassLoader(Callable <T> callable)
È£Ãâ½Ã¿¡ ÇöÀçÀÇ ¾×¼¼½º Á¦¾î ÄÁÅؽºÆ®¿¡ µû¶ó, ÇöÀçÀÇ ÄÁÅؽºÆ® Ŭ·¡½º ·Î´õ¸¦ ÄÁÅؽºÆ® Ŭ·¡½º ·Î´õ·Î ÇÏ´Â ÁöÁ¤µÈ callable¸¦ ½ÇÇàÇÏ´Â Callable °´Ã¼¸¦ ¸®ÅÏÇÕ´Ï´Ù. º¸Åë, ÀÌ ¸Þ¼­µå´Â AccessController.doPrivileged(java.security.PrivilegedAction) ¾×¼Ç³»¿¡¼­ È£ÃâÇØ callable¸¦ ÀÛ¼ºÇϵµ·Ï ÇÕ´Ï´Ù. callable´Â °¡´ÉÇÏ¸é ±× ¾×¼Ç³»ÀÇ ¼±ÅÃÇÑ Á¢±Ù ±ÇÇÑ ¼³Á¤¿¡ µû¶ó ½ÇÇàÇØ, °¡´ÉÇÏÁö ¾ÊÀ¸¸é °ü·ÃµÈ AccessControlException¸¦ Throw ÇÕ´Ï´Ù.

ÆĶó¹ÌÅÍ:
callable - ±âº»À¸·Î µÇ´Â ŽºÅ©
¹Ýȯ°ª:
È£ÃâÇØ °¡´ÉÇÑ °´Ã¼
¿¹¿Ü:
NullPointerException - callable°¡ nullÀÎ °æ¿ì
AccessControlException - ÇöÀçÀÇ ¾×¼¼½º Á¦¾î ÄÁÅؽºÆ®ÀÌ, ÄÁÅؽºÆ® Ŭ·¡½º ·Î´õÀÇ ¼³Á¤°ú ÃëµæÀÇ ¾çÂÊ ¸ðµÎÀÇ Á¢±Ù ±ÇÇÑÀ» º¸°ü À¯ÁöÇÏÁö ¾Ê´Â °æ¿ì

JavaTM 2 Platform
Standard Ed. 5.0

Copyright 2004 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms . Documentation Redistribution Policy µµ ÂüÁ¶ÇϽʽÿÀ.