JavaTM Platform
Standard Ed. 6

클래스
java.util.concurrent.TimeUnit 의 사용

TimeUnit 를 사용하고 있는 패키지
java.util.concurrent 병행 프로그래밍으로 자주(잘) 사용되는 유틸리티 클래스입니다.  
java.util.concurrent.locks 편입의 동기 및 감시와 구별된 상태의 락 및 대기용의 시스템를 제공하는 인터페이스 및 클래스.  
javax.swing 모든 플랫폼에서 가능한 한 똑같이 기능하는 「경량」(Java 공통 언어) 컴퍼넌트세트를 제공합니다.  
 

java.util.concurrent 에서의 TimeUnit 의 사용
 

TimeUnit 를 돌려주는 java.util.concurrent 의 메소드
static TimeUnit TimeUnit. valueOf (String  name)
          지정한 이름을 가지는 이 형태의 열거형 정수를 돌려줍니다.
static TimeUnit [] TimeUnit. values ()
          이 열거형의 정수를 포함한 배열이 선언되고 있는 순서로 돌려줍니다.
 

TimeUnit 형의 파라미터를 가지는 java.util.concurrent 의 메소드
 int CyclicBarrier. await (long timeout, TimeUnit  unit)
          모든파티가 이 배리어로 await 를 호출하는지, 지정된 대기 시간이 경과할 때까지 대기합니다.
 boolean CountDownLatch. await (long timeout, TimeUnit  unit)
          thread로인터럽트가 발생하는지, 지정된 대기 시간이 경과하지 않는 한, 빗장의 카운트다운이 제로가 될 때까지 현재의 thread를 대기시킵니다.
 boolean ThreadPoolExecutor. awaitTermination (long timeout, TimeUnit  unit)
           
 boolean ExecutorService. awaitTermination (long timeout, TimeUnit  unit)
          종료 요구 후에 모든 태스크가 실행을 완료하고 있었는지, 타임 아웃이 발생하는지, 현재의 thread로 인터럽트가 발생하는지, 그 어느쪽이든가 최초로 발생할 때까지 블록 합니다.
 long TimeUnit. convert (long sourceDuration, TimeUnit  sourceUnit)
          지정된 단위에 의한 지정된 시간을, 이 단위로 변환합니다.
 V Exchanger. exchange (V  x, long timeout, TimeUnit  unit)
          현재의 thread는,인터럽트가 발생하는지, 지정된 대기 시간이 경과하지 않는 한, 이제 한편의 thread가 이 교환 포인트에 이를 때까지 대기해, 지정된 객체를 그 thread에 전송 해, 대신에 이제(벌써) 한편의 thread의 객체를 받습니다.
 V FutureTask. get (long timeout, TimeUnit  unit)
           
 V Future. get (long timeout, TimeUnit  unit)
          필요에 따라서, 최대로 지정된 시간, 계산이 완료할 때까지 대기해, 그 후, 계산 결과가 이용 가능한 경우는 결과를 가져옵니다.
 long Delayed. getDelay (TimeUnit  unit)
          특정의 타임 유니트로, 이 객체와 관련하는 나머지의 지연을 돌려줍니다.
 long ThreadPoolExecutor. getKeepAliveTime (TimeUnit  unit)
          코어 풀 사이즈를 넘는 thread가 종료전에 IDLE 상태에 머물 수가 있는, thread의 킵얼라이브 시간을 돌려줍니다.
<T> List <Future <T>>
ExecutorService. invokeAll (Collection <? extends Callable <T>> tasks, long timeout, TimeUnit  unit)
          지정된 태스크를 실행해, 모든 것이 완료할까 마감 시간이 되는지, 그 어느쪽이든가 최초로 발생한 시점에서, 상태와 결과를 포함한 Future 의 리스트를 돌려줍니다.
<T> List <Future <T>>
AbstractExecutorService. invokeAll (Collection <? extends Callable <T>> tasks, long timeout, TimeUnit  unit)
           
<T> T
ExecutorService. invokeAny (Collection <? extends Callable <T>> tasks, long timeout, TimeUnit  unit)
          지정된 태스크를 실행해, 타임 아웃이 경과하기 전에 예외를 throw 하지 않고 정상적으로 완료한 태스크가 존재하는 경우는, 그 결과를 돌려줍니다.
<T> T
AbstractExecutorService. invokeAny (Collection <? extends Callable <T>> tasks, long timeout, TimeUnit  unit)
           
 boolean SynchronousQueue. offer (E  o, long timeout, TimeUnit  unit)
          지정된 요소를 이 큐에 삽입합니다.
 boolean PriorityBlockingQueue. offer (E  e, long timeout, TimeUnit  unit)
          지정된 요소를 이 우선도 큐에 삽입합니다.
 boolean LinkedBlockingQueue. offer (E  e, long timeout, TimeUnit  unit)
          지정된 요소를 이 큐의 말미에 삽입합니다.
 boolean LinkedBlockingDeque. offer (E  e, long timeout, TimeUnit  unit)
           
 boolean DelayQueue. offer (E  e, long timeout, TimeUnit  unit)
          지정된 요소를 이 지연 큐에 삽입합니다.
 boolean BlockingQueue. offer (E  e, long timeout, TimeUnit  unit)
          지정된 요소를 이 큐에 삽입합니다.
 boolean BlockingDeque. offer (E  e, long timeout, TimeUnit  unit)
          지정된 요소를 이 양단 큐로 나타내지는 큐 (즉, 이 양단 큐의 말미)에 삽입합니다.
 boolean ArrayBlockingQueue. offer (E  e, long timeout, TimeUnit  unit)
          지정된 요소를 이 큐의 말미에 삽입합니다.
 boolean LinkedBlockingDeque. offerFirst (E  e, long timeout, TimeUnit  unit)
           
 boolean BlockingDeque. offerFirst (E  e, long timeout, TimeUnit  unit)
          지정된 요소를 이 양단 큐의 선두에 삽입합니다.
 boolean LinkedBlockingDeque. offerLast (E  e, long timeout, TimeUnit  unit)
           
 boolean BlockingDeque. offerLast (E  e, long timeout, TimeUnit  unit)
          지정된 요소를 이 양단 큐의 말미에 삽입합니다.
 E SynchronousQueue. poll (long timeout, TimeUnit  unit)
          이 큐의 선두를 취득 및 삭제합니다.
 E PriorityBlockingQueue. poll (long timeout, TimeUnit  unit)
           
 E LinkedBlockingQueue. poll (long timeout, TimeUnit  unit)
           
 E LinkedBlockingDeque. poll (long timeout, TimeUnit  unit)
           
 Future <V > ExecutorCompletionService. poll (long timeout, TimeUnit  unit)
           
 E DelayQueue. poll (long timeout, TimeUnit  unit)
          이 큐의 선두를 취득 및 삭제합니다.
 Future <V > CompletionService. poll (long timeout, TimeUnit  unit)
          다음의 완료필 태스크를 나타내는 Future 를 취득해 삭제합니다.
 E BlockingQueue. poll (long timeout, TimeUnit  unit)
          이 큐의 선두를 취득해 삭제합니다.
 E BlockingDeque. poll (long timeout, TimeUnit  unit)
          이 양단 큐에 의해 나타내지는 큐의 선두 (즉, 이 양단 큐의 최초의 요소)를 취득해 삭제합니다.
 E ArrayBlockingQueue. poll (long timeout, TimeUnit  unit)
           
 E LinkedBlockingDeque. pollFirst (long timeout, TimeUnit  unit)
           
 E BlockingDeque. pollFirst (long timeout, TimeUnit  unit)
          이 양단 큐의 최초의 요소를 취득해 삭제합니다.
 E LinkedBlockingDeque. pollLast (long timeout, TimeUnit  unit)
           
 E BlockingDeque. pollLast (long timeout, TimeUnit  unit)
          이 양단 큐의 마지막 요소를 취득해 삭제합니다.
<V> ScheduledFuture <V>
ScheduledThreadPoolExecutor. schedule (Callable <V> callable, long delay, TimeUnit  unit)
           
<V> ScheduledFuture <V>
ScheduledExecutorService. schedule (Callable <V> callable, long delay, TimeUnit  unit)
          지정된 지연 후에 유효하게 되는 ScheduledFuture 를 작성해 실행합니다.
 ScheduledFuture <? > ScheduledThreadPoolExecutor. schedule (Runnable  command, long delay, TimeUnit  unit)
           
 ScheduledFuture <? > ScheduledExecutorService. schedule (Runnable  command, long delay, TimeUnit  unit)
          지정된 지연 후에 유효하게 되는 단발적인 액션을 작성해 실행합니다.
 ScheduledFuture <? > ScheduledThreadPoolExecutor. scheduleAtFixedRate (Runnable  command, long initialDelay, long period, TimeUnit  unit)
           
 ScheduledFuture <? > ScheduledExecutorService. scheduleAtFixedRate (Runnable  command, long initialDelay, long period, TimeUnit  unit)
          지정된 초기 지연의 경과후에 처음 유효하게 되어, 그 후는 지정된 기간 마다 유효하게 되는 정기적인 액션을 작성해 실행합니다.
 ScheduledFuture <? > ScheduledThreadPoolExecutor. scheduleWithFixedDelay (Runnable  command, long initialDelay, long delay, TimeUnit  unit)
           
 ScheduledFuture <? > ScheduledExecutorService. scheduleWithFixedDelay (Runnable  command, long initialDelay, long delay, TimeUnit  unit)
          지정된 초기 지연의 경과후에 처음 유효하게 되어, 그 후는 실행의 종료후부터 다음의 개시까지의 지정의 지연 마다 유효하게 되는 정기적인 액션을 작성해 실행합니다.
 void ThreadPoolExecutor. setKeepAliveTime (long time, TimeUnit  unit)
          thread가 종료전에 IDLE 상태에 머물 수가 있는 제한 시간을 설정합니다.
 boolean Semaphore. tryAcquire (int permits, long timeout, TimeUnit  unit)
          지정된 대기 시간내에 지정된 수의 허가(permit)가 이용 가능하고, 현재의 thread로 인터럽트 가 발생하고 있지 않는 경우에, 이 세마포어-로부터 지정된 수의 허가(permit)를 가져옵니다.
 boolean Semaphore. tryAcquire (long timeout, TimeUnit  unit)
          지정된 대기 시간내에 허가(permit)가 이용 가능하게 되어, 현재의 thread로 인터럽트 가 발생하고 있지 않는 경우에, 이 세마포어-로부터 허가(permit)를 가져옵니다.
 

TimeUnit 형의 파라미터를 가지는 java.util.concurrent 의 생성자
ThreadPoolExecutor (int corePoolSize, int maximumPoolSize, long keepAliveTime, TimeUnit  unit, BlockingQueue <Runnable > workQueue)
          지정된 초기 파라미터, 및 디폴트의 thread 팩토리라고 거부된 실행 핸들러를 사용해, 새로운 ThreadPoolExecutor 를 작성합니다.
ThreadPoolExecutor (int corePoolSize, int maximumPoolSize, long keepAliveTime, TimeUnit  unit, BlockingQueue <Runnable > workQueue, RejectedExecutionHandler  handler)
          지정된 초기 파라미터, 및 디폴트의 thread 팩토리를 사용해, 새로운 ThreadPoolExecutor 를 작성합니다.
ThreadPoolExecutor (int corePoolSize, int maximumPoolSize, long keepAliveTime, TimeUnit  unit, BlockingQueue <Runnable > workQueue, ThreadFactory  threadFactory)
          지정된 초기 파라미터, 및 디폴트의 거부된 실행 핸들러를 사용해, 새로운 ThreadPoolExecutor 를 작성합니다.
ThreadPoolExecutor (int corePoolSize, int maximumPoolSize, long keepAliveTime, TimeUnit  unit, BlockingQueue <Runnable > workQueue, ThreadFactory  threadFactory, RejectedExecutionHandler  handler)
          지정된 초기 파라미터를 사용해, 새로운 ThreadPoolExecutor 를 작성합니다.
 

java.util.concurrent.locks 에서의 TimeUnit 의 사용
 

TimeUnit 형의 파라미터를 가지는 java.util.concurrent.locks 의 메소드
 boolean AbstractQueuedSynchronizer.ConditionObject. await (long time, TimeUnit  unit)
          시간의 지정된 상태 대기를 구현합니다.
 boolean Condition. await (long time, TimeUnit  unit)
          신호가 송신되는, 인터럽트가 발생한다, 또는 지정된 대기 시간이 경과할 때까지, 현재의 thread를 대기시킵니다.
 boolean AbstractQueuedLongSynchronizer.ConditionObject. await (long time, TimeUnit  unit)
          시간의 지정된 상태 대기를 구현합니다.
 boolean ReentrantLock. tryLock (long timeout, TimeUnit  unit)
          지정된 대기 시간내에 다른 thread가 락을 보관 유지하지 않고, 현재의 thread로인터럽트가 발생하고 있지 않는 경우에, 락을 가져옵니다.
 boolean Lock. tryLock (long time, TimeUnit  unit)
          지정된 대기 시간내에 락이 이용 가능하고, 현재의 thread로인터럽트가 발생하고 있지 않는 경우에, 락을 가져옵니다.
 boolean ReentrantReadWriteLock.ReadLock. tryLock (long timeout, TimeUnit  unit)
          지정된 대기 시간내에 다른 thread가 기입해 락을 보관 유지하지 않고, 현재의 thread로인터럽트가 발생하고 있지 않는 경우에, read 락을 가져옵니다.
 boolean ReentrantReadWriteLock.WriteLock. tryLock (long timeout, TimeUnit  unit)
          지정된 대기 시간내에 다른 thread가 락을 보관 유지하지 않고, 현재의 thread로인터럽트가 발생하고 있지 않는 경우에, 기입 락을 가져옵니다.
 

javax.swing 에서의 TimeUnit 의 사용
 

TimeUnit 형의 파라미터를 가지는 javax.swing 의 메소드
 T SwingWorker. get (long timeout, TimeUnit  unit)
          필요에 따라서, 최대로 지정된 시간, 계산이 완료할 때까지 대기해, 그 후, 계산 결과가 이용 가능한 경우는 결과를 가져옵니다.
 


JavaTM Platform
Standard Ed. 6

버그의 보고와 기능의 요청
한층 더 자세한 API 레퍼런스 및 개발자 문서에 대해서는,Java SE 개발자용 문서를 참조해 주세요. 개발자전용의 상세한 해설, 개념의 개요, 용어의 정의, 버그의 회피책, 및 코드 실례가 포함되어 있습니다.

Copyright 2006 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms . Documentation Redistribution Policy 도 참조해 주세요.